summaryrefslogtreecommitdiffstats
path: root/src/core/file_sys/archive_savedata.cpp
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2015-02-11 00:27:16 +0100
committerbunnei <bunneidev@gmail.com>2015-02-11 00:27:16 +0100
commit27e6e6b3cb2ee1ab3a996c2b4be1d9a3c4e6b75d (patch)
treefd8b0290d4a0353c11c0e168200b20b5a89e297c /src/core/file_sys/archive_savedata.cpp
parentMerge pull request #553 from lioncash/denorm (diff)
parentPTM: Fixed a problem with the gamecoin PTM file. (diff)
downloadyuzu-27e6e6b3cb2ee1ab3a996c2b4be1d9a3c4e6b75d.tar
yuzu-27e6e6b3cb2ee1ab3a996c2b4be1d9a3c4e6b75d.tar.gz
yuzu-27e6e6b3cb2ee1ab3a996c2b4be1d9a3c4e6b75d.tar.bz2
yuzu-27e6e6b3cb2ee1ab3a996c2b4be1d9a3c4e6b75d.tar.lz
yuzu-27e6e6b3cb2ee1ab3a996c2b4be1d9a3c4e6b75d.tar.xz
yuzu-27e6e6b3cb2ee1ab3a996c2b4be1d9a3c4e6b75d.tar.zst
yuzu-27e6e6b3cb2ee1ab3a996c2b4be1d9a3c4e6b75d.zip
Diffstat (limited to 'src/core/file_sys/archive_savedata.cpp')
-rw-r--r--src/core/file_sys/archive_savedata.cpp23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/core/file_sys/archive_savedata.cpp b/src/core/file_sys/archive_savedata.cpp
index 3baee5294..8496e06f3 100644
--- a/src/core/file_sys/archive_savedata.cpp
+++ b/src/core/file_sys/archive_savedata.cpp
@@ -6,6 +6,7 @@
#include "common/common_types.h"
#include "common/file_util.h"
+#include "common/make_unique.h"
#include "core/file_sys/archive_savedata.h"
#include "core/file_sys/disk_archive.h"
@@ -28,26 +29,28 @@ static std::string GetSaveDataPath(const std::string& mount_location, u64 progra
return Common::StringFromFormat("%s%08x/%08x/data/00000001/", mount_location.c_str(), high, low);
}
-Archive_SaveData::Archive_SaveData(const std::string& sdmc_directory)
- : DiskArchive(GetSaveDataContainerPath(sdmc_directory)) {
+ArchiveFactory_SaveData::ArchiveFactory_SaveData(const std::string& sdmc_directory)
+ : mount_point(GetSaveDataContainerPath(sdmc_directory)) {
LOG_INFO(Service_FS, "Directory %s set as SaveData.", this->mount_point.c_str());
}
-ResultCode Archive_SaveData::Open(const Path& path) {
- if (concrete_mount_point.empty())
- concrete_mount_point = GetSaveDataPath(mount_point, Kernel::g_program_id);
+ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_SaveData::Open(const Path& path) {
+ std::string concrete_mount_point = GetSaveDataPath(mount_point, Kernel::g_program_id);
if (!FileUtil::Exists(concrete_mount_point)) {
// When a SaveData archive is created for the first time, it is not yet formatted
- // and the save file/directory structure expected by the game has not yet been initialized.
- // Returning the NotFormatted error code will signal the game to provision the SaveData archive
- // with the files and folders that it expects.
+ // and the save file/directory structure expected by the game has not yet been initialized.
+ // Returning the NotFormatted error code will signal the game to provision the SaveData archive
+ // with the files and folders that it expects.
return ResultCode(ErrorDescription::FS_NotFormatted, ErrorModule::FS,
ErrorSummary::InvalidState, ErrorLevel::Status);
}
- return RESULT_SUCCESS;
+
+ auto archive = Common::make_unique<DiskArchive>(std::move(concrete_mount_point));
+ return MakeResult<std::unique_ptr<ArchiveBackend>>(std::move(archive));
}
-ResultCode Archive_SaveData::Format(const Path& path) const {
+ResultCode ArchiveFactory_SaveData::Format(const Path& path) {
+ std::string concrete_mount_point = GetSaveDataPath(mount_point, Kernel::g_program_id);
FileUtil::DeleteDirRecursively(concrete_mount_point);
FileUtil::CreateFullPath(concrete_mount_point);
return RESULT_SUCCESS;