summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2019-11-12 14:06:37 +0100
committerLioncash <mathew1800@gmail.com>2019-11-12 14:52:18 +0100
commit64cbebc58fd40a5bde645f1b1e5d609de78476e9 (patch)
tree058091700860a467708bd933f4dbb0716733f010 /src
parentMerge pull request #3085 from bunnei/web-token-b64 (diff)
downloadyuzu-64cbebc58fd40a5bde645f1b1e5d609de78476e9.tar
yuzu-64cbebc58fd40a5bde645f1b1e5d609de78476e9.tar.gz
yuzu-64cbebc58fd40a5bde645f1b1e5d609de78476e9.tar.bz2
yuzu-64cbebc58fd40a5bde645f1b1e5d609de78476e9.tar.lz
yuzu-64cbebc58fd40a5bde645f1b1e5d609de78476e9.tar.xz
yuzu-64cbebc58fd40a5bde645f1b1e5d609de78476e9.tar.zst
yuzu-64cbebc58fd40a5bde645f1b1e5d609de78476e9.zip
Diffstat (limited to 'src')
-rw-r--r--src/core/crypto/key_manager.cpp26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/core/crypto/key_manager.cpp b/src/core/crypto/key_manager.cpp
index 222fc95ba..12f13b742 100644
--- a/src/core/crypto/key_manager.cpp
+++ b/src/core/crypto/key_manager.cpp
@@ -668,23 +668,27 @@ void KeyManager::WriteKeyToFile(KeyCategory category, std::string_view keyname,
const std::array<u8, Size>& key) {
const std::string yuzu_keys_dir = FileUtil::GetUserPath(FileUtil::UserPath::KeysDir);
std::string filename = "title.keys_autogenerated";
- if (category == KeyCategory::Standard)
+ if (category == KeyCategory::Standard) {
filename = dev_mode ? "dev.keys_autogenerated" : "prod.keys_autogenerated";
- else if (category == KeyCategory::Console)
+ } else if (category == KeyCategory::Console) {
filename = "console.keys_autogenerated";
- const auto add_info_text = !FileUtil::Exists(yuzu_keys_dir + DIR_SEP + filename);
- FileUtil::CreateFullPath(yuzu_keys_dir + DIR_SEP + filename);
- std::ofstream file(yuzu_keys_dir + DIR_SEP + filename, std::ios::app);
- if (!file.is_open())
+ }
+
+ const auto path = yuzu_keys_dir + DIR_SEP + filename;
+ const auto add_info_text = !FileUtil::Exists(path);
+ FileUtil::CreateFullPath(path);
+ FileUtil::IOFile file{path, "a"};
+ if (!file.IsOpen()) {
return;
+ }
if (add_info_text) {
- file
- << "# This file is autogenerated by Yuzu\n"
- << "# It serves to store keys that were automatically generated from the normal keys\n"
- << "# If you are experiencing issues involving keys, it may help to delete this file\n";
+ file.WriteString(
+ "# This file is autogenerated by Yuzu\n"
+ "# It serves to store keys that were automatically generated from the normal keys\n"
+ "# If you are experiencing issues involving keys, it may help to delete this file\n");
}
- file << fmt::format("\n{} = {}", keyname, Common::HexToString(key));
+ file.WriteString(fmt::format("\n{} = {}", keyname, Common::HexToString(key)));
AttemptLoadKeyFile(yuzu_keys_dir, yuzu_keys_dir, filename, category == KeyCategory::Title);
}