Added code to create a config file path for win32. This code uses the "AppData" environment variable instead of the shell api call to prevent library dependencies. If the environment variable is not found, the current directory is used.
This commit is contained in:
+21
-1
@@ -21,6 +21,11 @@
|
||||
#include "game.h"
|
||||
#include "guiinterface.h"
|
||||
#include "tinyxml.h"
|
||||
#include <cstdlib>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <direct.h>
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -32,9 +37,24 @@ Session::Session(GuiInterface* g) : actualGame(0), myGui(g)
|
||||
// Session an mainwindowimpl bergeben
|
||||
myGui->setSession(this);
|
||||
|
||||
//Konfiguration erstellen;
|
||||
// Konfiguration erstellen
|
||||
|
||||
string configFileName;
|
||||
#ifdef _WIN32
|
||||
const char *appDataPath = getenv("AppData");
|
||||
if (appDataPath)
|
||||
{
|
||||
configFileName = appDataPath;
|
||||
configFileName += "\\pokerth\\";
|
||||
mkdir(configFileName.c_str());
|
||||
}
|
||||
#else
|
||||
// hier Linux/Mac Code zur Basispfadbestimmung, z.B.
|
||||
configFileName = "~/pokerth";
|
||||
// wenn nicht existiert, erzeugen!
|
||||
#endif
|
||||
|
||||
configFileName += "config.xml";
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user