mirror of
https://github.com/stenzek/duckstation.git
synced 2025-06-07 12:05:52 +00:00
Settings: Log when creating EmuFolders fails
This commit is contained in:
parent
aae7573e63
commit
369879e685
@ -1,4 +1,4 @@
|
|||||||
// SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com>
|
// SPDX-FileCopyrightText: 2019-2025 Connor McLaughlin <stenzek@gmail.com>
|
||||||
// SPDX-License-Identifier: CC-BY-NC-ND-4.0
|
// SPDX-License-Identifier: CC-BY-NC-ND-4.0
|
||||||
|
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
#include "common/bitutils.h"
|
#include "common/bitutils.h"
|
||||||
|
#include "common/error.h"
|
||||||
#include "common/file_system.h"
|
#include "common/file_system.h"
|
||||||
#include "common/log.h"
|
#include "common/log.h"
|
||||||
#include "common/memmap.h"
|
#include "common/memmap.h"
|
||||||
@ -2261,25 +2262,31 @@ const char* Settings::GetPIODeviceTypeModeDisplayName(PIODeviceType type)
|
|||||||
"PIODeviceType");
|
"PIODeviceType");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string EmuFolders::AppRoot;
|
namespace EmuFolders {
|
||||||
std::string EmuFolders::DataRoot;
|
|
||||||
std::string EmuFolders::Bios;
|
std::string AppRoot;
|
||||||
std::string EmuFolders::Cache;
|
std::string DataRoot;
|
||||||
std::string EmuFolders::Cheats;
|
std::string Bios;
|
||||||
std::string EmuFolders::Covers;
|
std::string Cache;
|
||||||
std::string EmuFolders::GameIcons;
|
std::string Cheats;
|
||||||
std::string EmuFolders::GameSettings;
|
std::string Covers;
|
||||||
std::string EmuFolders::InputProfiles;
|
std::string GameIcons;
|
||||||
std::string EmuFolders::MemoryCards;
|
std::string GameSettings;
|
||||||
std::string EmuFolders::Patches;
|
std::string InputProfiles;
|
||||||
std::string EmuFolders::Resources;
|
std::string MemoryCards;
|
||||||
std::string EmuFolders::SaveStates;
|
std::string Patches;
|
||||||
std::string EmuFolders::Screenshots;
|
std::string Resources;
|
||||||
std::string EmuFolders::Shaders;
|
std::string SaveStates;
|
||||||
std::string EmuFolders::Subchannels;
|
std::string Screenshots;
|
||||||
std::string EmuFolders::Textures;
|
std::string Shaders;
|
||||||
std::string EmuFolders::UserResources;
|
std::string Subchannels;
|
||||||
std::string EmuFolders::Videos;
|
std::string Textures;
|
||||||
|
std::string UserResources;
|
||||||
|
std::string Videos;
|
||||||
|
|
||||||
|
static void EnsureFolderExists(const std::string& path);
|
||||||
|
|
||||||
|
} // namespace EmuFolders
|
||||||
|
|
||||||
void EmuFolders::SetDefaults()
|
void EmuFolders::SetDefaults()
|
||||||
{
|
{
|
||||||
@ -2392,33 +2399,35 @@ void EmuFolders::Update()
|
|||||||
System::UpdateMemoryCardTypes();
|
System::UpdateMemoryCardTypes();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EmuFolders::EnsureFoldersExist()
|
void EmuFolders::EnsureFolderExists(const std::string& path)
|
||||||
{
|
{
|
||||||
bool result = FileSystem::EnsureDirectoryExists(Bios.c_str(), false);
|
Error error;
|
||||||
result = FileSystem::EnsureDirectoryExists(Cache.c_str(), false) && result;
|
if (!FileSystem::EnsureDirectoryExists(path.c_str(), false, &error))
|
||||||
result = FileSystem::EnsureDirectoryExists(Path::Combine(Cache, "achievement_images").c_str(), false) && result;
|
ERROR_LOG("Failed to create directory {}: {}", path, error.GetDescription());
|
||||||
result = FileSystem::EnsureDirectoryExists(Cheats.c_str(), false) && result;
|
}
|
||||||
result = FileSystem::EnsureDirectoryExists(Covers.c_str(), false) && result;
|
|
||||||
result = FileSystem::EnsureDirectoryExists(GameIcons.c_str(), false) && result;
|
void EmuFolders::EnsureFoldersExist()
|
||||||
result = FileSystem::EnsureDirectoryExists(GameSettings.c_str(), false) && result;
|
{
|
||||||
result = FileSystem::EnsureDirectoryExists(InputProfiles.c_str(), false) && result;
|
EnsureFolderExists(Bios);
|
||||||
result = FileSystem::EnsureDirectoryExists(MemoryCards.c_str(), false) && result;
|
EnsureFolderExists(Cache);
|
||||||
result = FileSystem::EnsureDirectoryExists(Patches.c_str(), false) && result;
|
EnsureFolderExists(Path::Combine(Cache, "achievement_images"));
|
||||||
result = FileSystem::EnsureDirectoryExists(SaveStates.c_str(), false) && result;
|
EnsureFolderExists(Cheats);
|
||||||
result = FileSystem::EnsureDirectoryExists(Screenshots.c_str(), false) && result;
|
EnsureFolderExists(Covers);
|
||||||
result = FileSystem::EnsureDirectoryExists(Shaders.c_str(), false) && result;
|
EnsureFolderExists(GameIcons);
|
||||||
result = FileSystem::EnsureDirectoryExists(Path::Combine(Shaders, "reshade").c_str(), false) && result;
|
EnsureFolderExists(GameSettings);
|
||||||
result = FileSystem::EnsureDirectoryExists(
|
EnsureFolderExists(InputProfiles);
|
||||||
Path::Combine(Shaders, "reshade" FS_OSPATH_SEPARATOR_STR "Shaders").c_str(), false) &&
|
EnsureFolderExists(MemoryCards);
|
||||||
result;
|
EnsureFolderExists(Patches);
|
||||||
result = FileSystem::EnsureDirectoryExists(
|
EnsureFolderExists(SaveStates);
|
||||||
Path::Combine(Shaders, "reshade" FS_OSPATH_SEPARATOR_STR "Textures").c_str(), false) &&
|
EnsureFolderExists(Screenshots);
|
||||||
result;
|
EnsureFolderExists(Shaders);
|
||||||
result = FileSystem::EnsureDirectoryExists(Subchannels.c_str(), false) && result;
|
EnsureFolderExists(Path::Combine(Shaders, "reshade"));
|
||||||
result = FileSystem::EnsureDirectoryExists(Textures.c_str(), false) && result;
|
EnsureFolderExists(Path::Combine(Shaders, "reshade" FS_OSPATH_SEPARATOR_STR "Shaders"));
|
||||||
result = FileSystem::EnsureDirectoryExists(UserResources.c_str(), false) && result;
|
EnsureFolderExists(Path::Combine(Shaders, "reshade" FS_OSPATH_SEPARATOR_STR "Textures"));
|
||||||
result = FileSystem::EnsureDirectoryExists(Videos.c_str(), false) && result;
|
EnsureFolderExists(Subchannels);
|
||||||
return result;
|
EnsureFolderExists(Textures);
|
||||||
|
EnsureFolderExists(UserResources);
|
||||||
|
EnsureFolderExists(Videos);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string EmuFolders::GetOverridableResourcePath(std::string_view name)
|
std::string EmuFolders::GetOverridableResourcePath(std::string_view name)
|
||||||
|
@ -629,7 +629,7 @@ extern std::string Videos;
|
|||||||
|
|
||||||
// Assumes that AppRoot and DataRoot have been initialized.
|
// Assumes that AppRoot and DataRoot have been initialized.
|
||||||
void SetDefaults();
|
void SetDefaults();
|
||||||
bool EnsureFoldersExist();
|
void EnsureFoldersExist();
|
||||||
void LoadConfig(SettingsInterface& si);
|
void LoadConfig(SettingsInterface& si);
|
||||||
void Save(SettingsInterface& si);
|
void Save(SettingsInterface& si);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user