changeset 354:178b4bac54a1

- Using the /etc dir on Unix systems for all common settings. - Copy the default highlighter ini file on first start into users home config dir. - Use and create a temporary subdir in the systems temp folder. git-svn-id: svn://svn.code.sf.net/p/universalindent/code/trunk@578 59b1889a-e5ac-428c-b0c7-476e01d41282
author thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
date Mon, 14 Jan 2008 15:08:54 +0000
parents 39d33e6abc8f
children fbcfa91e004f
files src/mainwindow.cpp
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/mainwindow.cpp	Mon Jan 14 15:06:35 2008 +0000
+++ b/src/mainwindow.cpp	Mon Jan 14 15:08:54 2008 +0000
@@ -61,6 +61,7 @@
         settingsDirctoryStr = applicationBinaryPath + "/config";
         dirCreator.mkpath( settingsDirctoryStr );
         tempDirctoryStr = applicationBinaryPath + "/temp";
+        //TODO: If the portable drive has write protection, use local temp path and clean it up on exit.
         dirCreator.mkpath( tempDirctoryStr );
     }
     // ... otherwise use the system specific global application data path.
@@ -73,11 +74,17 @@
         QString commonAppBasePath = commonAppBasePathComponents.join("/");
 #else
         settingsDirctoryStr = QDir::homePath() + "/.config/UniversalIndentGUI";
-        QString commonAppBasePath = "/etc/xdg";
+        QString commonAppBasePath = "/etc";
 #endif
         dirCreator.mkpath( settingsDirctoryStr );
+        // If a highlighter config file does not exist in the users home config dir
+        // copy the default config file overthere.
+        if ( !QFile::exists(settingsDirctoryStr+"/UiGuiSyntaxHighlightConfig.ini") ) {
+            QFile::copy( commonAppBasePath+"/UniversalIndentGUI/config/UiGuiSyntaxHighlightConfig.ini", settingsDirctoryStr+"/UiGuiSyntaxHighlightConfig.ini" );
+        }
         indenterDirctoryStr = commonAppBasePath + "/UniversalIndentGUI/indenters";
-        tempDirctoryStr = QDir::tempPath();
+        tempDirctoryStr = QDir::tempPath() + "/UniversalIndentGUI";
+        dirCreator.mkpath( tempDirctoryStr );
     }
 
     // Init of some variables.