Merge pull request #4915 from leoetlino/ini-changes
Expose some ways to manage an INI file
This commit is contained in:
commit
722ff4c020
|
@ -87,8 +87,13 @@
|
|||
// Filenames
|
||||
// Files in the directory returned by GetUserPath(D_CONFIG_IDX)
|
||||
#define DOLPHIN_CONFIG "Dolphin.ini"
|
||||
#define GCPAD_CONFIG "GCPadNew.ini"
|
||||
#define WIIPAD_CONFIG "WiimoteNew.ini"
|
||||
#define GCKEYBOARD_CONFIG "GCKeyNew.ini"
|
||||
#define GFX_CONFIG "GFX.ini"
|
||||
#define DEBUGGER_CONFIG "Debugger.ini"
|
||||
#define LOGGER_CONFIG "Logger.ini"
|
||||
#define UI_CONFIG "UI.ini"
|
||||
|
||||
// Files in the directory returned by GetUserPath(D_LOGS_IDX)
|
||||
#define MAIN_LOG "dolphin.log"
|
||||
|
|
|
@ -783,8 +783,13 @@ static void RebuildUserDirectories(unsigned int dir_index)
|
|||
s_user_paths[D_WFSROOT_IDX] = s_user_paths[D_USER_IDX] + WFSROOT_DIR DIR_SEP;
|
||||
s_user_paths[D_BACKUP_IDX] = s_user_paths[D_USER_IDX] + BACKUP_DIR DIR_SEP;
|
||||
s_user_paths[F_DOLPHINCONFIG_IDX] = s_user_paths[D_CONFIG_IDX] + DOLPHIN_CONFIG;
|
||||
s_user_paths[F_GCPADCONFIG_IDX] = s_user_paths[D_CONFIG_IDX] + GCPAD_CONFIG;
|
||||
s_user_paths[F_WIIPADCONFIG_IDX] = s_user_paths[D_CONFIG_IDX] + WIIPAD_CONFIG;
|
||||
s_user_paths[F_GCKEYBOARDCONFIG_IDX] = s_user_paths[D_CONFIG_IDX] + GCKEYBOARD_CONFIG;
|
||||
s_user_paths[F_GFXCONFIG_IDX] = s_user_paths[D_CONFIG_IDX] + GFX_CONFIG;
|
||||
s_user_paths[F_DEBUGGERCONFIG_IDX] = s_user_paths[D_CONFIG_IDX] + DEBUGGER_CONFIG;
|
||||
s_user_paths[F_LOGGERCONFIG_IDX] = s_user_paths[D_CONFIG_IDX] + LOGGER_CONFIG;
|
||||
s_user_paths[F_UICONFIG_IDX] = s_user_paths[D_CONFIG_IDX] + UI_CONFIG;
|
||||
s_user_paths[F_MAINLOG_IDX] = s_user_paths[D_LOGS_IDX] + MAIN_LOG;
|
||||
s_user_paths[F_RAMDUMP_IDX] = s_user_paths[D_DUMP_IDX] + RAM_DUMP;
|
||||
s_user_paths[F_ARAMDUMP_IDX] = s_user_paths[D_DUMP_IDX] + ARAM_DUMP;
|
||||
|
@ -805,8 +810,12 @@ static void RebuildUserDirectories(unsigned int dir_index)
|
|||
|
||||
case D_CONFIG_IDX:
|
||||
s_user_paths[F_DOLPHINCONFIG_IDX] = s_user_paths[D_CONFIG_IDX] + DOLPHIN_CONFIG;
|
||||
s_user_paths[F_GCPADCONFIG_IDX] = s_user_paths[D_CONFIG_IDX] + GCPAD_CONFIG;
|
||||
s_user_paths[F_WIIPADCONFIG_IDX] = s_user_paths[D_CONFIG_IDX] + WIIPAD_CONFIG;
|
||||
s_user_paths[F_GFXCONFIG_IDX] = s_user_paths[D_CONFIG_IDX] + GFX_CONFIG;
|
||||
s_user_paths[F_DEBUGGERCONFIG_IDX] = s_user_paths[D_CONFIG_IDX] + DEBUGGER_CONFIG;
|
||||
s_user_paths[F_LOGGERCONFIG_IDX] = s_user_paths[D_CONFIG_IDX] + LOGGER_CONFIG;
|
||||
s_user_paths[F_UICONFIG_IDX] = s_user_paths[D_CONFIG_IDX] + UI_CONFIG;
|
||||
break;
|
||||
|
||||
case D_CACHE_IDX:
|
||||
|
|
|
@ -49,8 +49,13 @@ enum
|
|||
D_WFSROOT_IDX,
|
||||
D_BACKUP_IDX,
|
||||
F_DOLPHINCONFIG_IDX,
|
||||
F_GCPADCONFIG_IDX,
|
||||
F_WIIPADCONFIG_IDX,
|
||||
F_GCKEYBOARDCONFIG_IDX,
|
||||
F_GFXCONFIG_IDX,
|
||||
F_DEBUGGERCONFIG_IDX,
|
||||
F_LOGGERCONFIG_IDX,
|
||||
F_UICONFIG_IDX,
|
||||
F_MAINLOG_IDX,
|
||||
F_RAMDUMP_IDX,
|
||||
F_ARAMDUMP_IDX,
|
||||
|
|
|
@ -76,11 +76,15 @@ public:
|
|||
bool Get(const std::string& key, std::vector<std::string>* values) const;
|
||||
|
||||
bool operator<(const Section& other) const { return name < other.name; }
|
||||
using SectionMap = std::map<std::string, std::string, CaseInsensitiveStringCompare>;
|
||||
|
||||
const std::string& GetName() const { return name; }
|
||||
const SectionMap& GetValues() const { return values; }
|
||||
protected:
|
||||
std::string name;
|
||||
|
||||
std::vector<std::string> keys_order;
|
||||
std::map<std::string, std::string, CaseInsensitiveStringCompare> values;
|
||||
SectionMap values;
|
||||
|
||||
std::vector<std::string> lines;
|
||||
};
|
||||
|
@ -140,6 +144,7 @@ public:
|
|||
// In particular it is used in PostProcessing for its configuration
|
||||
static void ParseLine(const std::string& line, std::string* keyOut, std::string* valueOut);
|
||||
|
||||
const std::list<Section>& GetSections() const { return sections; }
|
||||
private:
|
||||
std::list<Section> sections;
|
||||
|
||||
|
|
Loading…
Reference in New Issue