Port FS, SD and dump path to onion config

This ports the Wii filesystem root, Wii SD card path and dump path
settings to the new config system (OnionConfig).

My initial plan was to wait until DolphinWX was removed before porting
most of the Main (Core, DSP, General) settings to onion config, but
I've decided to submit a small part of those changes to fix
[issue 10566](https://bugs.dolphin-emu.org/issues/10566).

Removes the need to manually set the FileUtil path in the UI frontends
and gets rid of some more members that don't really belong in SConfig.

Also fixes a bug which would cause the dump path not to get created
after change.
This commit is contained in:
Léo Lam
2018-05-23 15:55:48 +02:00
parent 93f49b1ca4
commit c99ac40700
7 changed files with 55 additions and 65 deletions

View File

@ -22,6 +22,7 @@
#include "Common/MsgHandler.h"
#include "Common/StringUtil.h"
#include "Core/Config/MainSettings.h"
#include "Core/ConfigLoaders/BaseConfigLoader.h"
#include "Core/ConfigManager.h"
#include "Core/Core.h"
@ -47,9 +48,31 @@
namespace UICommon
{
static void CreateDumpPath(const std::string& path)
{
if (path.empty())
return;
File::SetUserPath(D_DUMP_IDX, path + '/');
File::CreateFullPath(File::GetUserPath(D_DUMPAUDIO_IDX));
File::CreateFullPath(File::GetUserPath(D_DUMPDSP_IDX));
File::CreateFullPath(File::GetUserPath(D_DUMPSSL_IDX));
File::CreateFullPath(File::GetUserPath(D_DUMPFRAMES_IDX));
File::CreateFullPath(File::GetUserPath(D_DUMPTEXTURES_IDX));
}
static void InitCustomPaths()
{
File::SetUserPath(D_WIIROOT_IDX, Config::Get(Config::MAIN_FS_PATH));
CreateDumpPath(Config::Get(Config::MAIN_DUMP_PATH));
const std::string sd_path = Config::Get(Config::MAIN_SD_PATH);
if (!sd_path.empty())
File::SetUserPath(F_WIISDCARD_IDX, sd_path);
}
void Init()
{
Config::Init();
Config::AddConfigChangedCallback(InitCustomPaths);
Config::AddLayer(ConfigLoaders::GenerateBaseConfigLoader());
SConfig::Init();
LogManager::Init();