Add "Open User Folder" button (AppData on Windows)

This commit is contained in:
Agent X 2023-12-17 09:04:01 -05:00
parent ec4b547d1d
commit 2d36bfdc99
13 changed files with 52 additions and 4 deletions

View file

@ -276,6 +276,8 @@ CONTROLS = "Ovládání"
DISPLAY = "Video" DISPLAY = "Video"
SOUND = "Zvuk" SOUND = "Zvuk"
MISC = "Jiné" MISC = "Jiné"
USER_FOLDER = "Otevřít uživatelský adresář"
APPDATA = "Otevřít AppData"
[PAUSE] [PAUSE]
QUIT_TITLE = "ODPOJIT SE" QUIT_TITLE = "ODPOJIT SE"

View file

@ -276,6 +276,8 @@ CONTROLS = "Controles"
DISPLAY = "Weergave" DISPLAY = "Weergave"
SOUND = "Geluid" SOUND = "Geluid"
MISC = "Misc" MISC = "Misc"
USER_FOLDER = "Gebruikersmap openen"
APPDATA = "Open AppData"
[PAUSE] [PAUSE]
QUIT_TITLE = "STOPPEN" QUIT_TITLE = "STOPPEN"

View file

@ -191,9 +191,9 @@ SHARE_LIVES = "Share lives"
ENABLE_CHEATS = "Enable cheats" ENABLE_CHEATS = "Enable cheats"
BUBBLE_ON_DEATH = "Bubble on death" BUBBLE_ON_DEATH = "Bubble on death"
NAMETAGS = "Nametags \\#ffff00\\(NEW!)" NAMETAGS = "Nametags \\#ffff00\\(NEW!)"
BOUNCY_BOUNDS_ON_CAP = "On (Capped)" BOUNCY_BOUNDS_ON_CAP = "ON (Capped)"
BOUNCY_BOUNDS_ON = "On" BOUNCY_BOUNDS_ON = "ON"
BOUNCY_BOUNDS_OFF = "Off" BOUNCY_BOUNDS_OFF = "OFF"
BOUNCY_LEVEL_BOUNDS = "Bouncy Level Bounds \\#ffff00\\(NEW!)" BOUNCY_LEVEL_BOUNDS = "Bouncy Level Bounds \\#ffff00\\(NEW!)"
AMOUNT_OF_PLAYERS = "Amount of players" AMOUNT_OF_PLAYERS = "Amount of players"
@ -276,6 +276,8 @@ CONTROLS = "Controls"
DISPLAY = "Display" DISPLAY = "Display"
SOUND = "Sound" SOUND = "Sound"
MISC = "Misc" MISC = "Misc"
USER_FOLDER = "Open User Folder"
APPDATA = "Open AppData"
[PAUSE] [PAUSE]
QUIT_TITLE = "QUIT" QUIT_TITLE = "QUIT"

View file

@ -276,6 +276,8 @@ CONTROLS = "Contrôles"
DISPLAY = "Affichage" DISPLAY = "Affichage"
SOUND = "Audio" SOUND = "Audio"
MISC = "Autres Paramètres" MISC = "Autres Paramètres"
USER_FOLDER = "Ouvrir le dossier utilisateur"
APPDATA = "Ouvrir AppData"
[PAUSE] [PAUSE]
QUIT_TITLE = "QUITTER" QUIT_TITLE = "QUITTER"

View file

@ -276,6 +276,8 @@ CONTROLS = "Steuerung"
DISPLAY = "Anzeige" DISPLAY = "Anzeige"
SOUND = "Sound" SOUND = "Sound"
MISC = "Sonstiges" MISC = "Sonstiges"
USER_FOLDER = "Benutzerordner öffnen"
APPDATA = "AppData öffnen"
[PAUSE] [PAUSE]
QUIT_TITLE = "BEENDEN" QUIT_TITLE = "BEENDEN"

View file

@ -274,6 +274,8 @@ CONTROLS = "Comandi"
DISPLAY = "Grafica" DISPLAY = "Grafica"
SOUND = "Suono" SOUND = "Suono"
MISC = "Varie" MISC = "Varie"
USER_FOLDER = "Apri cartella utente"
APPDATA = "Apri AppData"
[PAUSE] [PAUSE]
QUIT_TITLE = "ABBANDONA" QUIT_TITLE = "ABBANDONA"

View file

@ -276,6 +276,8 @@ CONTROLS = "Sterowanie"
DISPLAY = "Wyswietlanie" DISPLAY = "Wyswietlanie"
SOUND = "Dzwiek" SOUND = "Dzwiek"
MISC = "Rozne" MISC = "Rozne"
USER_FOLDER = "Otwórz folder użytkownika"
APPDATA = "Otwórz AppData"
[PAUSE] [PAUSE]
QUIT_TITLE = "WYJSCIE" QUIT_TITLE = "WYJSCIE"

View file

@ -276,6 +276,8 @@ CONTROLS = "Controles"
DISPLAY = "Vídeo" DISPLAY = "Vídeo"
SOUND = "Som" SOUND = "Som"
MISC = "Outros" MISC = "Outros"
USER_FOLDER = "Abrir pasta do usuário"
APPDATA = "Abrir AppData"
[PAUSE] [PAUSE]
QUIT_TITLE = "SAIR" QUIT_TITLE = "SAIR"

View file

@ -275,6 +275,8 @@ CONTROLS = "Управление"
DISPLAY = "Дисплей" DISPLAY = "Дисплей"
SOUND = "Звук" SOUND = "Звук"
MISC = "Разное" MISC = "Разное"
USER_FOLDER = "Открыть папку пользователя"
APPDATA = "Открыть AppData"
[PAUSE] [PAUSE]
QUIT_TITLE = "QUIT" QUIT_TITLE = "QUIT"

View file

@ -276,6 +276,8 @@ CONTROLS = "Controles"
DISPLAY = "Pantalla" DISPLAY = "Pantalla"
SOUND = "Sonido" SOUND = "Sonido"
MISC = "Otros" MISC = "Otros"
USER_FOLDER = "Abrir carpeta de usuario"
APPDATA = "Abrir AppData"
[PAUSE] [PAUSE]
QUIT_TITLE = "SALIR" QUIT_TITLE = "SALIR"

View file

@ -276,6 +276,8 @@ CONTROLS = "Controles"
DISPLAY = "Pantalla" DISPLAY = "Pantalla"
SOUND = "Sonido" SOUND = "Sonido"
MISC = "Otros" MISC = "Otros"
USER_FOLDER = "Abrir carpeta de usuario"
APPDATA = "Abrir AppData"
[PAUSE] [PAUSE]
QUIT_TITLE = "SALIR" QUIT_TITLE = "SALIR"

View file

@ -12,6 +12,27 @@
#include "pc/utils/misc.h" #include "pc/utils/misc.h"
#include "pc/pc_main.h" #include "pc/pc_main.h"
#if defined(_WIN32) || defined(_WIN64)
#include <windows.h>
#endif
void djui_panel_options_open_user_folder(UNUSED struct DjuiBase* caller) {
#if defined(_WIN32) || defined(_WIN64)
// Windows
ShellExecuteA(NULL, "open", sys_user_path(), NULL, NULL, SW_SHOWNORMAL);
#elif __linux__
// Linux
char command[512];
snprintf(command, sizeof(command), "xdg-open %s", sys_user_path());
system(command);
#elif __APPLE__
// macOS
char command[512];
snprintf(command, sizeof(command), "open %s", sys_user_path());
system(command);
#endif
}
void djui_panel_options_back(struct DjuiBase* caller) { void djui_panel_options_back(struct DjuiBase* caller) {
configfile_save(configfile_name()); configfile_save(configfile_name());
djui_panel_menu_back(caller); djui_panel_menu_back(caller);
@ -33,6 +54,11 @@ void djui_panel_options_create(struct DjuiBase* caller) {
djui_button_create(body, DLANG(OPTIONS, DISPLAY), DJUI_BUTTON_STYLE_NORMAL, djui_panel_display_create); djui_button_create(body, DLANG(OPTIONS, DISPLAY), DJUI_BUTTON_STYLE_NORMAL, djui_panel_display_create);
djui_button_create(body, DLANG(OPTIONS, SOUND), DJUI_BUTTON_STYLE_NORMAL, djui_panel_sound_create); djui_button_create(body, DLANG(OPTIONS, SOUND), DJUI_BUTTON_STYLE_NORMAL, djui_panel_sound_create);
djui_button_create(body, DLANG(OPTIONS, MISC), DJUI_BUTTON_STYLE_NORMAL, djui_panel_misc_create); djui_button_create(body, DLANG(OPTIONS, MISC), DJUI_BUTTON_STYLE_NORMAL, djui_panel_misc_create);
#if defined(_WIN32) || defined(_WIN64)
djui_button_create(body, DLANG(OPTIONS, APPDATA), DJUI_BUTTON_STYLE_NORMAL, djui_panel_options_open_user_folder);
#elif __linux__ || __APPLE__ || __MACH__
djui_button_create(body, DLANG(OPTIONS, USER_FOLDER), DJUI_BUTTON_STYLE_NORMAL, djui_panel_options_open_user_folder);
#endif
djui_button_create(body, DLANG(MENU, BACK), DJUI_BUTTON_STYLE_BACK, djui_panel_options_back); djui_button_create(body, DLANG(MENU, BACK), DJUI_BUTTON_STYLE_BACK, djui_panel_options_back);
} }

View file

@ -626,7 +626,7 @@ const char* get_os_name(void) {
#if defined(_WIN32) || defined(_WIN64) #if defined(_WIN32) || defined(_WIN64)
return "Windows"; return "Windows";
#elif __APPLE__ || __MACH__ #elif __APPLE__ || __MACH__
return "Mac OSX"; return "Mac OSX"; // should be macOS
#elif __linux__ #elif __linux__
return "Linux"; return "Linux";
#elif __FreeBSD__ #elif __FreeBSD__