summaryrefslogtreecommitdiffstats
path: root/knights/knights.cpp
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2016-09-30 21:31:52 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2016-09-30 21:31:52 +0900
commitfebf3bbebfc048a068894f90d3a43d7fc6043aa3 (patch)
tree10db9fdafcdf4f1563aa6ec6259a259cba0e02cc /knights/knights.cpp
parent26ccf10eaceb1c3326ae2207bcd1cb6ecf6fd894 (diff)
downloadknights-febf3bbebfc048a068894f90d3a43d7fc6043aa3.tar.gz
knights-febf3bbebfc048a068894f90d3a43d7fc6043aa3.zip
Added user option to delete chess engine log files (game.### and log.###) from user home folder on exit.
This resolves bug 2665. Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'knights/knights.cpp')
-rw-r--r--knights/knights.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/knights/knights.cpp b/knights/knights.cpp
index 89f994f..f9d3867 100644
--- a/knights/knights.cpp
+++ b/knights/knights.cpp
@@ -49,6 +49,7 @@ Knights::Knights(TDECmdLineArgs *Args, TQWidget *parent, const char *name) : TDE
SplashScreen = NULL;
setFocusPolicy( TQ_ClickFocus );
}
+
Knights::~Knights()
{
if( !InitAll )
@@ -101,6 +102,7 @@ void Knights::menuClose(void)
{
if( !queryClose() )
return;
+
tqApp->quit();
}
///////////////////////////////////////
@@ -114,6 +116,24 @@ bool Knights::queryClose(void)
}
///////////////////////////////////////
//
+// Knights::aboutToQuit
+//
+///////////////////////////////////////
+void Knights::aboutToQuit(void)
+{
+ if (Resource->OPTION_Delete_Logs)
+ {
+ // Delete log files on exit. Only files named "game.###" and "log.###"
+ // placed in the user home folder will be removed
+ TQDir userdir( TQDir::homeDirPath(), "game.[0-9][0-9]*;log.[0-9][0-9]*" );
+ for ( int i = 0; i < userdir.count(); i++ )
+ {
+ userdir.remove( userdir.absFilePath(userdir[i]), TRUE );
+ }
+ }
+}
+///////////////////////////////////////
+//
// Knights::KillAll
//
///////////////////////////////////////