From 2b454df7ce367595ac26ff024d0b61488fac1069 Mon Sep 17 00:00:00 2001 From: lotodore Date: Sun, 21 Jan 2007 01:06:38 +0000 Subject: [PATCH] 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. --- src/session.cpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/session.cpp b/src/session.cpp index bb36a9ac..827ad88d 100755 --- a/src/session.cpp +++ b/src/session.cpp @@ -21,6 +21,11 @@ #include "game.h" #include "guiinterface.h" #include "tinyxml.h" +#include + +#ifdef _WIN32 +#include +#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"; }