mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-06-09 20:41:38 +12:00
[Crypto] Slightly more robust error handling
This commit is contained in:
parent
0494ca0064
commit
3cf8427670
5 changed files with 41 additions and 34 deletions
|
@ -137,15 +137,17 @@ bool Emulator::loadROM(const std::filesystem::path& path) {
|
|||
char* appData = SDL_GetPrefPath(nullptr, "Alber");
|
||||
const std::filesystem::path appDataPath = std::filesystem::path(appData);
|
||||
const std::filesystem::path dataPath = appDataPath / path.filename().stem();
|
||||
const std::filesystem::path aesKeysPath = appDataPath / "sysdata" / "aes_keys.txt";
|
||||
const std::filesystem::path aesKeysPath = appDataPath / "sysdata" / "aes_keys.txt";
|
||||
IOFile::setAppDataDir(dataPath);
|
||||
SDL_free(appData);
|
||||
|
||||
if (std::filesystem::exists(aesKeysPath)) {
|
||||
// Open the text file containing our AES keys if it exists. We use the std::filesystem::exists overload that takes an error code param to
|
||||
// avoid the call throwing exceptions
|
||||
std::error_code ec;
|
||||
if (std::filesystem::exists(aesKeysPath, ec) && !ec) {
|
||||
aesEngine.loadKeys(aesKeysPath);
|
||||
}
|
||||
|
||||
SDL_free(appData);
|
||||
|
||||
kernel.initializeFS();
|
||||
auto extension = path.extension();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue