diff base/ResourceFinder.cpp @ 680:27cdabba2d3e

Better system-specific unbundle locations for ResourceFinder; use same location for TempDirectory
author Chris Cannam
date Mon, 09 May 2011 16:58:24 +0100
parents c8badbd4c005
children b4a8d8221eaf
line wrap: on
line diff
--- a/base/ResourceFinder.cpp	Wed May 04 14:05:08 2011 +0100
+++ b/base/ResourceFinder.cpp	Mon May 09 16:58:24 2011 +0100
@@ -47,7 +47,7 @@
      - on OS/X, in $HOME/Library/Application Support/<appname>
 
      - on Windows, in %ProgramFiles%/<company>/<appname>
-     - on Windows, in (where?)
+     - on Windows, in (where?) something from http://msdn.microsoft.com/en-us/library/dd378457%28v=vs.85%29.aspx ?
 
    These locations are searched in reverse order (user-installed
    copies take priority over system-installed copies take priority
@@ -92,12 +92,20 @@
 QString
 ResourceFinder::getUserResourcePrefix()
 {
+#ifdef Q_OS_WIN32
+    char *homedrive = getenv("HOMEDRIVE");
+    char *homepath = getenv("HOMEPATH");
+    QString home;
+    if (homedrive && homepath) {
+        home = QString("%1%2").arg(homedrive).arg(homepath);
+    } else {
+        home = QDir::home().absolutePath();
+    }
+    if (home == "") return "";
+    return QString("%1/.%2").arg(qApp->applicationName()); //!!! wrong
+#else
     char *home = getenv("HOME");
     if (!home || !home[0]) return "";
-
-#ifdef Q_OS_WIN32
-    return QString(); //!!!???
-#else
 #ifdef Q_OS_MAC
     return QString("%1/Library/Application Support/%2/%3")
         .arg(home)