Changes for Win98 support.

This commit is contained in:
lotodore
2007-04-13 22:10:55 +00:00
parent cd37f783ef
commit 496261de7b
3 changed files with 130 additions and 119 deletions
+2
View File
@@ -88,6 +88,8 @@ Reason:
0x02 - Server full 0x02 - Server full
0x03 - Game is already running 0x03 - Game is already running
0x04 - Invalid Password 0x04 - Invalid Password
0x05 - Player Name already in use
0x06 - Invalid Player Name
0xFF - Other cause 0xFF - Other cause
+14 -5
View File
@@ -26,6 +26,7 @@
#define MODUS 0711 #define MODUS 0711
#ifdef _WIN32 #ifdef _WIN32
#include <windows.h>
#include <direct.h> #include <direct.h>
#endif #endif
@@ -43,20 +44,28 @@ ConfigFile::ConfigFile()
configFileName = appDataPath; configFileName = appDataPath;
} }
else { else {
configFileName = getcwd(); const int MaxPathSize = 1024;
char curDir[MaxPathSize + 1];
curDir[0] = 0;
_getcwd(curDir, MaxPathSize);
curDir[MaxPathSize] = 0;
configFileName = curDir;
// Testen ob das Verzeichnis beschreibbar ist // Testen ob das Verzeichnis beschreibbar ist
ofstream tmpFile; ofstream tmpFile;
         const char *tmpFileName = "pokerth_test.tmp"; const char *tmpFileName = "pokerth_test.tmp";
         tmpFile.open(tmpFileName); tmpFile.open((configFileName + "\\" + tmpFileName).c_str());
if (tmpFile) { if (tmpFile) {
// Erfolgreich, Verzeichnis beschreibbar. // Erfolgreich, Verzeichnis beschreibbar.
// Datei wieder loeschen. // Datei wieder loeschen.
tmpFile.close(); tmpFile.close();
remove(tmpFileName); remove((configFileName + "\\" + tmpFileName).c_str());
} }
else { else {
// Fehlgeschlagen, Verzeichnis nicht beschreibbar // Fehlgeschlagen, Verzeichnis nicht beschreibbar
configFileName = "C:\\Windows\\Temp\\"; curDir[0] = 0;
GetTempPathA(MaxPathSize, curDir);
curDir[MaxPathSize] = 0;
configFileName = curDir;
} }
} }
//Programmordner erstellen //Programmordner erstellen