Config: Remove the use of multiple search paths.

This commit is contained in:
Henrik Rydgård 2021-05-30 12:39:16 +02:00
parent c803e9fc58
commit 72915f88c8
5 changed files with 10 additions and 8 deletions

View file

@ -364,10 +364,10 @@ bool CreateFullPath(const Path &path) {
std::string fullPath = path.ToString();
int panicCounter = 100;
VERBOSE_LOG(COMMON, "CreateFullPath: path %s", fullPath.c_str());
VERBOSE_LOG(COMMON, "CreateFullPath: '%s'", fullPath.c_str());
if (File::Exists(fullPath)) {
DEBUG_LOG(COMMON, "CreateFullPath: path exists %s", fullPath.c_str());
DEBUG_LOG(COMMON, "CreateFullPath: path already exists: '%s'", fullPath.c_str());
return true;
}

View file

@ -1607,7 +1607,10 @@ const Path Config::FindConfigFile(const std::string &baseFilename) {
if (!File::Exists(filename)) {
// Make sure at least the directory it's supposed to be in exists.
Path path = filename.NavigateUp();
File::CreateFullPath(path);
// This check is just to avoid logging.
if (!File::Exists(path)) {
File::CreateFullPath(path);
}
}
return filename;
}

View file

@ -97,7 +97,10 @@ bool IsAudioInitialised();
void UpdateLoadedFile(FileLoader *fileLoader);
// NOTE: These are almost all derived from g_Config.memStickDirectory directly -
// they are not stored anywhere.
Path GetSysDirectory(PSPDirectories directoryType);
#ifdef _WIN32
void InitSysDirectories();
#endif

View file

@ -92,9 +92,6 @@ PPSSPP_UWPMain::PPSSPP_UWPMain(App ^app, const std::shared_ptr<DX::DeviceResourc
langRegion = "en_US";
}
char configFilename[MAX_PATH] = { 0 };
char controlsConfigFilename[MAX_PATH] = { 0 };
std::wstring memstickFolderW = ApplicationData::Current->LocalFolder->Path->Data();
g_Config.memStickDirectory = Path(memstickFolderW);
@ -108,7 +105,7 @@ PPSSPP_UWPMain::PPSSPP_UWPMain(App ^app, const std::shared_ptr<DX::DeviceResourc
// if it's not loaded here first.
g_Config.AddSearchPath(GetSysDirectory(DIRECTORY_SYSTEM));
g_Config.SetDefaultPath(GetSysDirectory(DIRECTORY_SYSTEM));
g_Config.Load(configFilename, controlsConfigFilename);
g_Config.Load();
bool debugLogLevel = false;

View file

@ -583,7 +583,6 @@ int WINAPI WinMain(HINSTANCE _hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLin
// Load config up here, because those changes below would be overwritten
// if it's not loaded here first.
g_Config.AddSearchPath(Path());
g_Config.AddSearchPath(GetSysDirectory(DIRECTORY_SYSTEM));
g_Config.SetDefaultPath(GetSysDirectory(DIRECTORY_SYSTEM));
g_Config.Load(configFilename.c_str(), controlsConfigFilename.c_str());