From c4ed791164df7e3e74042a37a62077b4dc4ade91 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 15 Aug 2020 08:33:16 -0400 Subject: common/fileutil: Convert namespace to Common::FS Migrates a remaining common file over to the Common namespace, making it consistent with the rest of common files. This also allows for high-traffic FS related code to alias the filesystem function namespace as namespace FS = Common::FS; for more concise typing. --- src/core/hle/service/acc/acc.cpp | 8 ++++---- src/core/hle/service/acc/profile_manager.cpp | 22 +++++++++++----------- 2 files changed, 15 insertions(+), 15 deletions(-) (limited to 'src/core/hle/service/acc') diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp index 63e4aeca0..eb54cb123 100644 --- a/src/core/hle/service/acc/acc.cpp +++ b/src/core/hle/service/acc/acc.cpp @@ -35,7 +35,7 @@ constexpr ResultCode ERR_INVALID_BUFFER_SIZE{ErrorModule::Account, 30}; constexpr ResultCode ERR_FAILED_SAVE_DATA{ErrorModule::Account, 100}; static std::string GetImagePath(Common::UUID uuid) { - return FileUtil::GetUserPath(FileUtil::UserPath::NANDDir) + + return Common::FS::GetUserPath(Common::FS::UserPath::NANDDir) + "/system/save/8000000000000010/su/avators/" + uuid.FormatSwitch() + ".jpg"; } @@ -318,7 +318,7 @@ protected: IPC::ResponseBuilder rb{ctx, 3}; rb.Push(RESULT_SUCCESS); - const FileUtil::IOFile image(GetImagePath(user_id), "rb"); + const Common::FS::IOFile image(GetImagePath(user_id), "rb"); if (!image.IsOpen()) { LOG_WARNING(Service_ACC, "Failed to load user provided image! Falling back to built-in backup..."); @@ -340,7 +340,7 @@ protected: IPC::ResponseBuilder rb{ctx, 3}; rb.Push(RESULT_SUCCESS); - const FileUtil::IOFile image(GetImagePath(user_id), "rb"); + const Common::FS::IOFile image(GetImagePath(user_id), "rb"); if (!image.IsOpen()) { LOG_WARNING(Service_ACC, @@ -405,7 +405,7 @@ protected: ProfileData data; std::memcpy(&data, user_data.data(), sizeof(ProfileData)); - FileUtil::IOFile image(GetImagePath(user_id), "wb"); + Common::FS::IOFile image(GetImagePath(user_id), "wb"); if (!image.IsOpen() || !image.Resize(image_data.size()) || image.WriteBytes(image_data.data(), image_data.size()) != image_data.size() || diff --git a/src/core/hle/service/acc/profile_manager.cpp b/src/core/hle/service/acc/profile_manager.cpp index a98d57b5c..9b829e957 100644 --- a/src/core/hle/service/acc/profile_manager.cpp +++ b/src/core/hle/service/acc/profile_manager.cpp @@ -13,6 +13,7 @@ namespace Service::Account { +namespace FS = Common::FS; using Common::UUID; struct UserRaw { @@ -318,9 +319,8 @@ bool ProfileManager::SetProfileBaseAndData(Common::UUID uuid, const ProfileBase& } void ProfileManager::ParseUserSaveFile() { - FileUtil::IOFile save(FileUtil::GetUserPath(FileUtil::UserPath::NANDDir) + - ACC_SAVE_AVATORS_BASE_PATH + "profiles.dat", - "rb"); + const FS::IOFile save( + FS::GetUserPath(FS::UserPath::NANDDir) + ACC_SAVE_AVATORS_BASE_PATH + "profiles.dat", "rb"); if (!save.IsOpen()) { LOG_WARNING(Service_ACC, "Failed to load profile data from save data... Generating new " @@ -366,22 +366,22 @@ void ProfileManager::WriteUserSaveFile() { }; } - const auto raw_path = - FileUtil::GetUserPath(FileUtil::UserPath::NANDDir) + "/system/save/8000000000000010"; - if (FileUtil::Exists(raw_path) && !FileUtil::IsDirectory(raw_path)) - FileUtil::Delete(raw_path); + const auto raw_path = FS::GetUserPath(FS::UserPath::NANDDir) + "/system/save/8000000000000010"; + if (FS::Exists(raw_path) && !FS::IsDirectory(raw_path)) { + FS::Delete(raw_path); + } - const auto path = FileUtil::GetUserPath(FileUtil::UserPath::NANDDir) + - ACC_SAVE_AVATORS_BASE_PATH + "profiles.dat"; + const auto path = + FS::GetUserPath(FS::UserPath::NANDDir) + ACC_SAVE_AVATORS_BASE_PATH + "profiles.dat"; - if (!FileUtil::CreateFullPath(path)) { + if (!FS::CreateFullPath(path)) { LOG_WARNING(Service_ACC, "Failed to create full path of profiles.dat. Create the directory " "nand/system/save/8000000000000010/su/avators to mitigate this " "issue."); return; } - FileUtil::IOFile save(path, "wb"); + FS::IOFile save(path, "wb"); if (!save.IsOpen()) { LOG_WARNING(Service_ACC, "Failed to write save data to file... No changes to user data " -- cgit v1.2.3