key_manager: Use regular std::string instead of std::string_view
The benefit of std::string_view comes from the idea of avoiding copies (essentially acting as a non-owning view), however if we're just going to copy into a local variable immediately, there's not much benefit gained here.
This commit is contained in:
parent
2b06301dbf
commit
c1f76abfaf
|
@ -66,8 +66,7 @@ KeyManager::KeyManager() {
|
||||||
AttemptLoadKeyFile(yuzu_keys_dir, hactool_keys_dir, "title.keys", true);
|
AttemptLoadKeyFile(yuzu_keys_dir, hactool_keys_dir, "title.keys", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void KeyManager::LoadFromFile(std::string_view filename_, bool is_title_keys) {
|
void KeyManager::LoadFromFile(const std::string& filename, bool is_title_keys) {
|
||||||
const auto filename = std::string(filename_);
|
|
||||||
std::ifstream file(filename);
|
std::ifstream file(filename);
|
||||||
if (!file.is_open())
|
if (!file.is_open())
|
||||||
return;
|
return;
|
||||||
|
@ -107,11 +106,8 @@ void KeyManager::LoadFromFile(std::string_view filename_, bool is_title_keys) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void KeyManager::AttemptLoadKeyFile(std::string_view dir1_, std::string_view dir2_,
|
void KeyManager::AttemptLoadKeyFile(const std::string& dir1, const std::string& dir2,
|
||||||
std::string_view filename_, bool title) {
|
const std::string& filename, bool title) {
|
||||||
const std::string dir1(dir1_);
|
|
||||||
const std::string dir2(dir2_);
|
|
||||||
const std::string filename(filename_);
|
|
||||||
if (FileUtil::Exists(dir1 + DIR_SEP + filename))
|
if (FileUtil::Exists(dir1 + DIR_SEP + filename))
|
||||||
LoadFromFile(dir1 + DIR_SEP + filename, title);
|
LoadFromFile(dir1 + DIR_SEP + filename, title);
|
||||||
else if (FileUtil::Exists(dir2 + DIR_SEP + filename))
|
else if (FileUtil::Exists(dir2 + DIR_SEP + filename))
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
|
#include <string>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@ -109,9 +110,9 @@ private:
|
||||||
std::unordered_map<KeyIndex<S256KeyType>, Key256> s256_keys;
|
std::unordered_map<KeyIndex<S256KeyType>, Key256> s256_keys;
|
||||||
|
|
||||||
bool dev_mode;
|
bool dev_mode;
|
||||||
void LoadFromFile(std::string_view filename, bool is_title_keys);
|
void LoadFromFile(const std::string& filename, bool is_title_keys);
|
||||||
void AttemptLoadKeyFile(std::string_view dir1, std::string_view dir2, std::string_view filename,
|
void AttemptLoadKeyFile(const std::string& dir1, const std::string& dir2,
|
||||||
bool title);
|
const std::string& filename, bool title);
|
||||||
|
|
||||||
static const std::unordered_map<std::string, KeyIndex<S128KeyType>> s128_file_id;
|
static const std::unordered_map<std::string, KeyIndex<S128KeyType>> s128_file_id;
|
||||||
static const std::unordered_map<std::string, KeyIndex<S256KeyType>> s256_file_id;
|
static const std::unordered_map<std::string, KeyIndex<S256KeyType>> s256_file_id;
|
||||||
|
|
Reference in New Issue