diff base/TempDirectory.cpp @ 520:e340b2fb9471

* Make FileSource able to indicate its preferred content type (e.g. application/rdf+xml in preference to text/html for rdf content) * Temp directory on Windows -- make $HOME expand to homedrive+homepath instead of user profile location (which may be networked)
author Chris Cannam
date Thu, 11 Dec 2008 15:18:10 +0000
parents 93fb1ebff76b
children 1415e35881f6
line wrap: on
line diff
--- a/base/TempDirectory.cpp	Thu Dec 11 12:37:16 2008 +0000
+++ b/base/TempDirectory.cpp	Thu Dec 11 15:18:10 2008 +0000
@@ -62,7 +62,17 @@
     QString svDirParent = settings.value("create-in", "$HOME").toString();
     settings.endGroup();
 
+#ifdef Q_OS_WIN32
+    char *homedrive = getenv("HOMEDRIVE");
+    char *homepath = getenv("HOMEPATH");
+    if (homedrive && homepath) {
+        svDirParent.replace("$HOME", QString("%1%2").arg(homedrive).arg(homepath));
+    } else {
+        svDirParent.replace("$HOME", QDir::home().absolutePath());
+    }
+#else
     svDirParent.replace("$HOME", QDir::home().absolutePath());
+#endif
 
     QString svDirBase = ".sv1";
     QString svDir = QDir(svDirParent).filePath(svDirBase);