@@ -1,3 +1,4 @@
|
|||||||
#todo items for future releases
|
#todo items for future releases
|
||||||
|
|
||||||
- save games to continue at the saved game-state
|
- save games to continue at the saved game-state#
|
||||||
|
- blinking start-stop button when click start is needed for next round
|
||||||
@@ -39,20 +39,38 @@ ConfigFile::ConfigFile()
|
|||||||
// Pfad und Dateinamen setzen
|
// Pfad und Dateinamen setzen
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
const char *appDataPath = getenv("AppData");
|
const char *appDataPath = getenv("AppData");
|
||||||
if (appDataPath)
|
if (appDataPath && appDataPath[0] != 0) {
|
||||||
{ //Programmordner erstellen
|
|
||||||
configFileName = appDataPath;
|
configFileName = appDataPath;
|
||||||
configFileName += "\\pokerth\\";
|
|
||||||
mkdir(configFileName.c_str());
|
|
||||||
//Log-File Ordner auch erstellen
|
|
||||||
logDir = configFileName;
|
|
||||||
logDir += "log-files\\";
|
|
||||||
mkdir(logDir.c_str());
|
|
||||||
//data Ordner auch erstellen
|
|
||||||
dataDir = configFileName;
|
|
||||||
dataDir += "data\\";
|
|
||||||
mkdir(dataDir.c_str());
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
configFileName = getcwd();
|
||||||
|
//Testen ob das Verzeichnis beschreibbar ist
|
||||||
|
ofstream tmpFile;
|
||||||
|
const char *tmpFileName = "pokerth_test.tmp";
|
||||||
|
tmpFile.open(tmpFileName);
|
||||||
|
if (tmpFile) {
|
||||||
|
// Erfolgreich, Verzeichnis beschreibbar.
|
||||||
|
// Datei wieder loeschen.
|
||||||
|
tmpFile.close();
|
||||||
|
remove(tmpFileName);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// Fehlgeschlagen, Verzeichnis nicht beschreibbar
|
||||||
|
configFileName = "C:\\Windows\\Temp\\";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//Programmordner erstellen
|
||||||
|
configFileName += "\\pokerth\\";
|
||||||
|
mkdir(configFileName.c_str());
|
||||||
|
//Log-File Ordner auch erstellen
|
||||||
|
logDir = configFileName;
|
||||||
|
logDir += "log-files\\";
|
||||||
|
mkdir(logDir.c_str());
|
||||||
|
//data Ordner auch erstellen
|
||||||
|
dataDir = configFileName;
|
||||||
|
dataDir += "data\\";
|
||||||
|
mkdir(dataDir.c_str());
|
||||||
|
|
||||||
#else
|
#else
|
||||||
//Programmordner erstellen
|
//Programmordner erstellen
|
||||||
const char *homePath = getenv("HOME");
|
const char *homePath = getenv("HOME");
|
||||||
|
|||||||
@@ -56,36 +56,38 @@ Log::Log(mainWindowImpl* w) : myW(w)
|
|||||||
myLogFile->close();
|
myLogFile->close();
|
||||||
|
|
||||||
linesInFile = 3;
|
linesInFile = 3;
|
||||||
}
|
|
||||||
|
|
||||||
//Zu alte Dateien löschen!!!
|
//Zu alte Dateien löschen!!!
|
||||||
int daysUntilWaste = myConfig->readConfigInt("LogStoreDuration");
|
int daysUntilWaste = myConfig->readConfigInt("LogStoreDuration");
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
QStringList filters("pokerth-log*");
|
QStringList filters("pokerth-log*");
|
||||||
QStringList logFileList = myLogDir->entryList(filters, QDir::Files);
|
QStringList logFileList = myLogDir->entryList(filters, QDir::Files);
|
||||||
|
|
||||||
for(i=0; i<logFileList.count(); i++) {
|
for(i=0; i<logFileList.count(); i++) {
|
||||||
|
|
||||||
// cout << logFileList.at(i).toStdString() << endl;
|
// cout << logFileList.at(i).toStdString() << endl;
|
||||||
|
|
||||||
QString dateString = logFileList.at(i);
|
QString dateString = logFileList.at(i);
|
||||||
dateString.remove("pokerth-log-");
|
dateString.remove("pokerth-log-");
|
||||||
dateString.remove(10,14);
|
dateString.remove(10,14);
|
||||||
|
|
||||||
QDate dateOfFile(QDate::fromString(dateString, Qt::ISODate));
|
QDate dateOfFile(QDate::fromString(dateString, Qt::ISODate));
|
||||||
QDate today(QDate::currentDate());
|
QDate today(QDate::currentDate());
|
||||||
|
|
||||||
// cout << dateOfFile.daysTo(today) << endl;
|
// cout << dateOfFile.daysTo(today) << endl;
|
||||||
|
|
||||||
if (dateOfFile.daysTo(today) > daysUntilWaste) {
|
if (dateOfFile.daysTo(today) > daysUntilWaste) {
|
||||||
|
|
||||||
|
// cout << QString::QString(myLogDir->absolutePath()+"/"+logFileList.at(i)).toStdString() << endl;
|
||||||
|
QFile fileToDelete(myLogDir->absolutePath()+"/"+logFileList.at(i));
|
||||||
|
fileToDelete.remove();
|
||||||
|
}
|
||||||
|
|
||||||
// cout << QString::QString(myLogDir->absolutePath()+"/"+logFileList.at(i)).toStdString() << endl;
|
|
||||||
QFile fileToDelete(myLogDir->absolutePath()+"/"+logFileList.at(i));
|
|
||||||
fileToDelete.remove();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else { cout << "Log directory doesn't exists. Cannot create log files"; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 2.0 MiB After Width: | Height: | Size: 728 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 738 B |
|
Before Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 2.5 KiB |