Mercurial > hg > forks > UniversalIndentGUI
changeset 609:137112d073ed
Ensured that some trailing slashes on retrieved paths are always consistent.
git-svn-id: svn://svn.code.sf.net/p/universalindent/code/trunk@868 59b1889a-e5ac-428c-b0c7-476e01d41282
author | thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282> |
---|---|
date | Fri, 24 Oct 2008 12:37:57 +0000 |
parents | a7046b28cf6e |
children | 193ccb04013e |
files | src/SettingsPaths.cpp |
diffstat | 1 files changed, 25 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/SettingsPaths.cpp Fri Oct 24 12:36:42 2008 +0000 +++ b/src/SettingsPaths.cpp Fri Oct 24 12:37:57 2008 +0000 @@ -52,6 +52,10 @@ void SettingsPaths::init() { // Get the applications binary path, with respect to MacOSXs use of the .app folder. applicationBinaryPath = QCoreApplication::applicationDirPath(); + // Remove any trailing slashes + while ( applicationBinaryPath.right(1) == "/" ) { + applicationBinaryPath.chop(1); + } #ifdef UNIVERSALINDENTGUI_NPP_EXPORTS applicationBinaryPath += "/plugins/uigui"; @@ -87,11 +91,22 @@ QDir dirCreator; #ifdef Q_OS_WIN // Get the local users application settings directory. - settingsPath = QDir::fromNativeSeparators( qgetenv("APPDATA") ) + "/UniversalIndentGUI"; + // Remove any trailing slashes. + settingsPath = QDir::fromNativeSeparators( qgetenv("APPDATA") ); + while ( settingsPath.right(1) == "/" ) { + settingsPath.chop(1); + } + settingsPath = settingsPath + "/UniversalIndentGUI"; + // On windows systems the directories "indenters", "translations" are subdirs of the applicationBinaryPath. globalFilesPath = applicationBinaryPath; #else - settingsPath = QDir::homePath() + "/.universalindentgui"; + // Remove any trailing slashes. + settingsPath = QDir::homePath(); + while ( settingsPath.right(1) == "/" ) { + settingsPath.chop(1); + } + settingsPath = settingsPath + "/.universalindentgui"; globalFilesPath = "/usr/share/universalindentgui"; #endif dirCreator.mkpath( settingsPath ); @@ -101,11 +116,15 @@ QFile::copy( globalFilesPath+"/config/UiGuiSyntaxHighlightConfig.ini", settingsPath+"/UiGuiSyntaxHighlightConfig.ini" ); } indenterPath = globalFilesPath + "/indenters"; -#ifdef Q_OS_WIN + + // On different systems it may be that "QDir::tempPath()" ends with a "/" or not. So check this. + // Remove any trailing slashes. + tempPath = QDir::tempPath(); + while ( tempPath.right(1) == "/" ) { + tempPath.chop(1); + } tempPath = QDir::tempPath() + "/UniversalIndentGUI"; -#else - tempPath = QDir::tempPath() + "UniversalIndentGUI"; -#endif + dirCreator.mkpath( tempPath ); }