sys: Tons of long overdue cleanup

- std::string -> const std::string& where needed
- Added a FileIO abstraction class
- Fixed recent files not updating
- Removed localization file from global include
- Renamed lang to pattern_language/pl
- Renamed EventFileDropped to RequestFileOpen
This commit is contained in:
WerWolv
2021-09-08 15:18:24 +02:00
parent d7707bae62
commit e74c0f5cf5
74 changed files with 549 additions and 494 deletions

View File

@@ -27,13 +27,13 @@ namespace hex {
}
bool ProjectFile::load(std::string_view filePath) {
bool ProjectFile::load(const std::string &filePath) {
ProjectFile::s_hasUnsavedChanged = false;
json projectFileData;
try {
std::ifstream projectFile(filePath.data());
std::ifstream projectFile(filePath.c_str());
projectFile >> projectFileData;
ProjectFile::s_filePath = projectFileData["filePath"];
@@ -56,7 +56,7 @@ namespace hex {
return true;
}
bool ProjectFile::store(std::string_view filePath) {
bool ProjectFile::store(std::string filePath) {
EventManager::post<EventProjectFileStore>();
json projectFileData;
@@ -74,7 +74,7 @@ namespace hex {
projectFileData["bookmarks"].push_back(bookmark);
}
std::ofstream projectFile(filePath.data(), std::fstream::trunc);
std::ofstream projectFile(filePath.c_str(), std::fstream::trunc);
projectFile << projectFileData;
} catch (json::exception &e) {
return false;