Fix how languages detect the lang file path

This commit is contained in:
MysterD 2023-04-14 11:04:22 -07:00
parent 71b616c76c
commit bc946aa3b3
1 changed files with 6 additions and 1 deletions

View File

@ -2,6 +2,8 @@
#include "djui_unicode.h"
#include "pc/ini.h"
#include "pc/platform.h"
#include "pc/mods/mods.h"
#include "pc/mods/mods_utils.h"
ini_t* sLang = NULL;
@ -13,9 +15,12 @@ bool djui_language_init(char* lang) {
}
// construct path
char exePath[SYS_MAX_PATH] = "";
path_get_folder((char*)path_to_executable(), exePath);
char path[SYS_MAX_PATH] = "";
if (!lang || lang[0] == '\0') { lang = "English"; }
snprintf(path, SYS_MAX_PATH, "%s/lang/%s.ini", sys_exe_path(), lang);
snprintf(path, SYS_MAX_PATH, "%s/lang/%s.ini", exePath, lang);
// load
sLang = ini_load(path);