mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-08 20:16:27 +02:00
Merge pull request #14489 from hrydgard/remove-multiple-config-search-paths
Remove multiple config search paths
This commit is contained in:
7 files changed
+21
-35
No files matched your search
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
+9
-15
@@ -1577,12 +1577,8 @@ void Config::CleanRecent() {
|
||||
recentIsos = cleanedRecent;
|
||||
}
|
||||
|
||||
void Config::SetDefaultPath(const Path &defaultPath) {
|
||||
defaultPath_ = defaultPath;
|
||||
}
|
||||
|
||||
void Config::AddSearchPath(const Path &path) {
|
||||
searchPath_.push_back(path);
|
||||
void Config::SetSearchPath(const Path &searchPath) {
|
||||
searchPath_ = searchPath;
|
||||
}
|
||||
|
||||
const Path Config::FindConfigFile(const std::string &baseFilename) {
|
||||
@@ -1596,17 +1592,15 @@ const Path Config::FindConfigFile(const std::string &baseFilename) {
|
||||
}
|
||||
#endif
|
||||
|
||||
for (size_t i = 0; i < searchPath_.size(); ++i) {
|
||||
Path filename = searchPath_[i] / baseFilename;
|
||||
if (File::Exists(filename)) {
|
||||
return filename;
|
||||
}
|
||||
Path filename = searchPath_ / baseFilename;
|
||||
if (File::Exists(filename)) {
|
||||
return filename;
|
||||
}
|
||||
|
||||
const Path filename = defaultPath_ / baseFilename;
|
||||
if (!File::Exists(filename)) {
|
||||
// Make sure at least the directory it's supposed to be in exists.
|
||||
Path path = filename.NavigateUp();
|
||||
// Make sure at least the directory it's supposed to be in exists.
|
||||
Path path = filename.NavigateUp();
|
||||
// This check is just to avoid logging.
|
||||
if (!File::Exists(path)) {
|
||||
File::CreateFullPath(path);
|
||||
}
|
||||
return filename;
|
||||
|
||||
+2
-6
@@ -505,10 +505,7 @@ public:
|
||||
Path getGameConfigFile(const std::string &gameId);
|
||||
bool hasGameConfig(const std::string &game_id);
|
||||
|
||||
// Used when the file is not found in the search path. Trailing slash.
|
||||
void SetDefaultPath(const Path &defaultPath);
|
||||
// Use a trailing slash.
|
||||
void AddSearchPath(const Path &path);
|
||||
void SetSearchPath(const Path &path);
|
||||
const Path FindConfigFile(const std::string &baseFilename);
|
||||
|
||||
// Utility functions for "recent" management
|
||||
@@ -536,8 +533,7 @@ private:
|
||||
std::string gameIdTitle_;
|
||||
Path iniFilename_;
|
||||
Path controllerIniFilename_;
|
||||
std::vector<Path> searchPath_;
|
||||
Path defaultPath_;
|
||||
Path searchPath_;
|
||||
};
|
||||
|
||||
std::map<std::string, std::pair<std::string, int>> GetLangValuesMapping();
|
||||
|
||||
@@ -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
|
||||
|
||||
+2
-3
@@ -539,14 +539,13 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch
|
||||
LogManager::Init(&g_Config.bEnableLogging);
|
||||
|
||||
#if !PPSSPP_PLATFORM(WINDOWS)
|
||||
g_Config.AddSearchPath(Path(user_data_path));
|
||||
g_Config.AddSearchPath(GetSysDirectory(DIRECTORY_SYSTEM));
|
||||
g_Config.SetDefaultPath(GetSysDirectory(DIRECTORY_SYSTEM));
|
||||
g_Config.SetSearchPath(GetSysDirectory(DIRECTORY_SYSTEM));
|
||||
|
||||
// Note that if we don't have storage permission here, loading the config will
|
||||
// fail and it will be set to the default. Later, we load again when we get permission.
|
||||
g_Config.Load();
|
||||
#endif
|
||||
|
||||
LogManager *logman = LogManager::GetInstance();
|
||||
|
||||
#if PPSSPP_PLATFORM(ANDROID)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -106,9 +103,8 @@ PPSSPP_UWPMain::PPSSPP_UWPMain(App ^app, const std::shared_ptr<DX::DeviceResourc
|
||||
|
||||
// Load config up here, because those changes below would be overwritten
|
||||
// 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.SetSearchPath(GetSysDirectory(DIRECTORY_SYSTEM));
|
||||
g_Config.Load();
|
||||
|
||||
bool debugLogLevel = false;
|
||||
|
||||
|
||||
+1
-3
@@ -583,9 +583,7 @@ 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.SetSearchPath(GetSysDirectory(DIRECTORY_SYSTEM));
|
||||
g_Config.Load(configFilename.c_str(), controlsConfigFilename.c_str());
|
||||
|
||||
bool debugLogLevel = false;
|
||||
|
||||
Reference in new issue
Block a user