diff options
author | bunnei <bunneidev@gmail.com> | 2018-08-04 14:33:11 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-04 14:33:11 -0400 |
commit | 2b06301dbfbfe79687219bf7783a6d1b47695401 (patch) | |
tree | 222cc27ecbc7f7e86d2edef8d36436600dee7d7a /src/common/file_util.cpp | |
parent | 13d65937533a5b38b5e4d07cfa2101e2a5643d9f (diff) | |
parent | 13cdf1f15952cdce306e8c241b7d156496f72fe5 (diff) |
Merge pull request #849 from DarkLordZach/xci
XCI and Encrypted NCA Support
Diffstat (limited to 'src/common/file_util.cpp')
-rw-r--r-- | src/common/file_util.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp index b8dd92b651..7aeda737f4 100644 --- a/src/common/file_util.cpp +++ b/src/common/file_util.cpp @@ -706,6 +706,7 @@ const std::string& GetUserPath(UserPath path, const std::string& new_path) { paths.emplace(UserPath::SDMCDir, user_path + SDMC_DIR DIR_SEP); paths.emplace(UserPath::NANDDir, user_path + NAND_DIR DIR_SEP); paths.emplace(UserPath::SysDataDir, user_path + SYSDATA_DIR DIR_SEP); + paths.emplace(UserPath::KeysDir, user_path + KEYS_DIR DIR_SEP); // TODO: Put the logs in a better location for each OS paths.emplace(UserPath::LogDir, user_path + LOG_DIR DIR_SEP); } @@ -736,6 +737,19 @@ const std::string& GetUserPath(UserPath path, const std::string& new_path) { return paths[path]; } +std::string GetHactoolConfigurationPath() { +#ifdef _WIN32 + PWSTR pw_local_path = nullptr; + if (SHGetKnownFolderPath(FOLDERID_Profile, 0, nullptr, &pw_local_path) != S_OK) + return ""; + std::string local_path = Common::UTF16ToUTF8(pw_local_path); + CoTaskMemFree(pw_local_path); + return local_path + "\\.switch"; +#else + return GetHomeDirectory() + "/.switch"; +#endif +} + size_t WriteStringToFile(bool text_file, const std::string& str, const char* filename) { return FileUtil::IOFile(filename, text_file ? "w" : "wb").WriteBytes(str.data(), str.size()); } |