Add buttons to open settings file and config directory

Only tested on macOS
This commit is contained in:
def 2021-12-19 01:23:29 +01:00
parent ffc532a302
commit 7484ffc125

View file

@ -258,6 +258,38 @@ void CMenus::RenderSettingsGeneral(CUIRect MainView)
m_NeedRestartGeneral = s_ClShowConsole != g_Config.m_ClShowConsole;
#endif
Left.HSplitTop(15.0f, 0, &Left);
CUIRect SettingsButton;
Left.HSplitBottom(25.0f, &Left, &SettingsButton);
SettingsButton.HSplitTop(5.0f, 0, &SettingsButton);
static int s_SettingsButtonID = 0;
if(DoButton_Menu(&s_SettingsButtonID, Localize("Settings file"), 0, &SettingsButton))
{
char aBuf[IO_MAX_PATH_LENGTH];
Storage()->GetCompletePath(IStorage::TYPE_SAVE, "settings_ddnet.cfg", aBuf, sizeof(aBuf));
if(!open_file(aBuf))
{
dbg_msg("menus", "couldn't open file");
}
}
Left.HSplitTop(15.0f, 0, &Left);
CUIRect ConfigButton;
Left.HSplitBottom(25.0f, &Left, &ConfigButton);
ConfigButton.HSplitTop(5.0f, 0, &ConfigButton);
static int s_ConfigButtonID = 0;
if(DoButton_Menu(&s_ConfigButtonID, Localize("Config directory"), 0, &ConfigButton))
{
char aBuf[IO_MAX_PATH_LENGTH];
Storage()->GetCompletePath(IStorage::TYPE_SAVE, "", aBuf, sizeof(aBuf));
if(!open_file(aBuf))
{
dbg_msg("menus", "couldn't open file");
}
}
Left.HSplitTop(15.0f, 0, &Left);
CUIRect DirectoryButton;
Left.HSplitBottom(25.0f, &Left, &DirectoryButton);