r21530 by craig - Add oldApplicationDataDir function to enable moving of data files

scribus-commit scribus-commit at lists.scribus.net
Mon Nov 21 19:07:42 UTC 2016


Author: craig
Date: Mon Nov 21 19:07:42 2016
New Revision: 21530

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=21530
Log:
Add oldApplicationDataDir function to enable moving of data files

Modified:
    trunk/Scribus/scribus/prefsmanager.cpp
    trunk/Scribus/scribus/scpaths.cpp
    trunk/Scribus/scribus/scpaths.h

Modified: trunk/Scribus/scribus/prefsmanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21530&path=/trunk/Scribus/scribus/prefsmanager.cpp
==============================================================================
--- trunk/Scribus/scribus/prefsmanager.cpp	(original)
+++ trunk/Scribus/scribus/prefsmanager.cpp	Mon Nov 21 19:07:42 2016
@@ -750,7 +750,7 @@
 	QFileInfo oldPi3 = QFileInfo(oldPR3);
 	if (oldPi3.exists())
 		moveFile(oldPR3, m_prefsLocation+"scrap.scs");
-	QString oldPrefsLocation(QDir::homePath()+"/.scribus/");
+	QString oldPrefsLocation(ScPaths::oldApplicationDataDir());
 	QString oldPR4 = QDir::toNativeSeparators(oldPrefsLocation + "scribus150.rc");
 	QFileInfo oldPi4 = QFileInfo(oldPR4);
 	if (oldPi4.exists())

Modified: trunk/Scribus/scribus/scpaths.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21530&path=/trunk/Scribus/scribus/scpaths.cpp
==============================================================================
--- trunk/Scribus/scribus/scpaths.cpp	(original)
+++ trunk/Scribus/scribus/scpaths.cpp	Mon Nov 21 19:07:42 2016
@@ -491,6 +491,29 @@
 	return createDirs;
 }
 
+QString ScPaths::oldApplicationDataDir(void)
+{
+#ifdef Q_OS_WIN32
+	QString appData = windowsSpecialDir(CSIDL_APPDATA);
+	if (QDir(appData).exists())
+#ifdef APPLICATION_DATA_DIR
+	return (appData + "/" + APPLICATION_DATA_DIR + "/");
+#else
+	return (appData + "/Scribus/");
+#endif
+#endif
+
+#ifdef APPLICATION_DATA_DIR
+	return QDir::homePath() + "/" + APPLICATION_DATA_DIR + "/";
+#else
+	#ifdef Q_OS_MAC
+		return (QDir::homePath() + "/Library/Preferences/Scribus/");
+	#else
+		return (QDir::homePath() + "/.scribus/");
+	#endif
+#endif
+}
+
 QString ScPaths::applicationDataDir(bool createIfNotExists)
 {
 	QString dataDir;

Modified: trunk/Scribus/scribus/scpaths.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21530&path=/trunk/Scribus/scribus/scpaths.h
==============================================================================
--- trunk/Scribus/scribus/scpaths.h	(original)
+++ trunk/Scribus/scribus/scpaths.h	Mon Nov 21 19:07:42 2016
@@ -73,6 +73,8 @@
 	static QString preferencesDir(bool createIfNotExists = false);
 	/** @brief Return path to application data dir*/
 	static QString applicationDataDir(bool createIfNotExists = false);
+	/** @brief Return path to pre XDG/QStandardPaths application data dir*/
+	static QString oldApplicationDataDir(void);
 	/** @brief Return path to application data dir for downloaded hyph dictionaries*/
 	static QString userDictDir(ScPaths::DictType dictType, bool createIfNotExists);
 	/** @brief Return path to application data dir for downloaded fonts*/




More information about the scribus-commit mailing list