summaryrefslogtreecommitdiff
path: root/Source/Core/Common/SettingsHandler.cpp
diff options
context:
space:
mode:
authorLéo Lam <leo@innovatetechnologi.es>2018-05-11 10:41:00 +0200
committerGitHub <noreply@github.com>2018-05-11 10:41:00 +0200
commite1866d35e505c4f3b22d45ab8df8df58d69ff1c8 (patch)
tree422f86e75bdc893a6009045c17b2dbb7d0646729 /Source/Core/Common/SettingsHandler.cpp
parent5071973a51e84b8a128fbc13f229259d816ba96e (diff)
parenta977a564342916945e87384288424d5893b3a414 (diff)
Merge pull request #6807 from leoetlino/boot
Boot: Migrate to new filesystem interface
Diffstat (limited to 'Source/Core/Common/SettingsHandler.cpp')
-rw-r--r--Source/Core/Common/SettingsHandler.cpp29
1 files changed, 9 insertions, 20 deletions
diff --git a/Source/Core/Common/SettingsHandler.cpp b/Source/Core/Common/SettingsHandler.cpp
index 8a0240939b..6ce08f6579 100644
--- a/Source/Core/Common/SettingsHandler.cpp
+++ b/Source/Core/Common/SettingsHandler.cpp
@@ -19,8 +19,6 @@
#endif
#include "Common/CommonTypes.h"
-#include "Common/File.h"
-#include "Common/FileUtil.h"
#include "Common/SettingsHandler.h"
#include "Common/Timer.h"
@@ -29,33 +27,24 @@ SettingsHandler::SettingsHandler()
Reset();
}
-bool SettingsHandler::Open(const std::string& settings_file_path)
+SettingsHandler::SettingsHandler(Buffer&& buffer)
{
- Reset();
-
- File::IOFile file{settings_file_path, "rb"};
- if (!file.ReadBytes(m_buffer.data(), m_buffer.size()))
- return false;
-
- Decrypt();
- return true;
+ SetBytes(std::move(buffer));
}
-bool SettingsHandler::Save(const std::string& destination_file_path) const
+const SettingsHandler::Buffer& SettingsHandler::GetBytes() const
{
- if (!File::CreateFullPath(destination_file_path))
- return false;
-
- File::IOFile file{destination_file_path, "wb"};
- return file.WriteBytes(m_buffer.data(), m_buffer.size());
+ return m_buffer;
}
-const u8* SettingsHandler::GetData() const
+void SettingsHandler::SetBytes(SettingsHandler::Buffer&& buffer)
{
- return m_buffer.data();
+ Reset();
+ m_buffer = std::move(buffer);
+ Decrypt();
}
-const std::string SettingsHandler::GetValue(const std::string& key)
+std::string SettingsHandler::GetValue(const std::string& key) const
{
std::string delim = std::string("\r\n");
std::string toFind = delim + key + "=";