16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-21 00:09:19 +02:00

Change config locations

This commit is contained in:
2025-11-03 19:59:42 +01:00
parent 4d342d274e
commit 1797990d58
5 changed files with 116 additions and 8 deletions

View File

@@ -896,12 +896,34 @@ eu07_application::init_files() {
mkdir("logs", 0755);
#endif
}
namespace fs = std::filesystem;
int
eu07_application::init_settings( int Argc, char *Argv[] ) {
Global.asVersion = VERSION_INFO;
Global.LoadIniFile( "eu07.ini" );
fs::path iniPath;
#ifdef _WIN32
if (const char *appdata = std::getenv("APPDATA"))
{
iniPath = fs::path(appdata) / "MaSzyna" / "Config" / "eu07.ini";
}
#else
if (const char *home = std::getenv("HOME"))
{
iniPath = fs::path(home) / ".config" / "MaSzyna" / "eu07.ini";
}
#endif
if (!iniPath.empty() && fs::exists(iniPath))
{
Global.LoadIniFile(iniPath.string().c_str());
}
else
{
Global.LoadIniFile("eu07.ini");
}
// process command line arguments
for( int i = 1; i < Argc; ++i ) {