Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core - StorageFile #175

Open
wants to merge 62 commits into
base: main
Choose a base branch
from
Open

Core - StorageFile #175

wants to merge 62 commits into from

Conversation

EmmmaTech
Copy link
Contributor

@EmmmaTech EmmmaTech commented Jun 5, 2022

This implements the feature described in #140.
This PR was originally located at #146, however due to branch reorganization, I had to reopen it in a new PR.

See natinusala#140 in the upstream repo for more information.
It checks in the brls.json file for a key called "appname" and sets the config folder to, for example, /config/borealis_demo
If the client is on Switch, then config_folder is set to /config/borealis_demo. If it's on PC, then config_folder is set to ./config/borealis_demo. (Where . is the folder where the executable is)
Also changed the documentation comment above writeToFile to make it more descriptive.
I'm open to suggestions on this, I doubt the forever while loop would be good for performance and the QueryAttribute function works correctly.
This is here because TinyXML2 doesn't support STL types like std::string (I'm pretty sure from my research).

So if the brls::StorageFile template is std::string or any other STL type, it might not work correctly.
Currently, the app will abort due to a buffer overflow. I'm going to work on it and try to fix it.
Turns out it was because the XML file is empty and the root element is NULL.

For some reason though, tinyxml2 is not actually saving the file.
A StorageObject is pretty much a value in the XML file, but in the code. The idea here is that writeToFile can take in a StorageObject and call its getters.
EmmmaTech and others added 29 commits March 22, 2021 15:42
Quick commit for fixing up functions charToOther and otherToChar.

Compilation test successful, runtime test hasn't been done yet.
So, I just tested everything, and it actually works!

No issues, besides making two XML elements with the same name but different values...
There is a new class called StorageFile, the original StorageFile class is now BasicStorageFile.

This new StorageFile class includes some functions that make this Pull Request closer to the original design.
When I mean overwrite, I mean it'll delete an existing element with the same name attribute as the one that needs to be added.

If this is off (it's on by default), then writeToFile will never finish and quit.
Added some additional comments about a compiler error (I have no idea how to fix it)
This is only for testing purposes.
Tested via the GLFW Platform. Finally was able to compile and run Borealis on macOS.
Macros - Added and changed up the macros

BasicStorageFile - Switched from using vectors to maps

BasicStorageFile - Slightly changed some of the logic in writeToFile

BasicStorageFile - Removed the createStorageObject functions
Demo - Changed Font Size for the text
Util - Fixed the conversion functions
borealis.hpp - Added Util.hpp
Now I love VSCode more.

BasicStorageFile - Added statement to clear up an already used allStorageObjects map (might've caused a segmentation fault)
BasicStorageFile - Fixed bug where the app would crash when the config folder doesn't exist

BasicStorageFile - Fixed bug where the saving document part never got it's error code

SettingsFile - Changed from class to struct
BasicStorageFile - Changed error handling logic with saving

Macros - Changed the name of some parameters to make it less confusing
The Switch build complained about std::filesystem::current_path().
@EmmmaTech EmmmaTech mentioned this pull request Jun 5, 2022
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant