Mercurial > hg > svcore
comparison 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 |
comparison
equal
deleted
inserted
replaced
679:c8badbd4c005 | 680:27cdabba2d3e |
---|---|
45 | 45 |
46 - on OS/X, in /Library/Application Support/<appname> | 46 - on OS/X, in /Library/Application Support/<appname> |
47 - on OS/X, in $HOME/Library/Application Support/<appname> | 47 - on OS/X, in $HOME/Library/Application Support/<appname> |
48 | 48 |
49 - on Windows, in %ProgramFiles%/<company>/<appname> | 49 - on Windows, in %ProgramFiles%/<company>/<appname> |
50 - on Windows, in (where?) | 50 - on Windows, in (where?) something from http://msdn.microsoft.com/en-us/library/dd378457%28v=vs.85%29.aspx ? |
51 | 51 |
52 These locations are searched in reverse order (user-installed | 52 These locations are searched in reverse order (user-installed |
53 copies take priority over system-installed copies take priority | 53 copies take priority over system-installed copies take priority |
54 over bundled copies). Also, /usr/local takes priority over /usr. | 54 over bundled copies). Also, /usr/local takes priority over /usr. |
55 */ | 55 */ |
90 } | 90 } |
91 | 91 |
92 QString | 92 QString |
93 ResourceFinder::getUserResourcePrefix() | 93 ResourceFinder::getUserResourcePrefix() |
94 { | 94 { |
95 #ifdef Q_OS_WIN32 | |
96 char *homedrive = getenv("HOMEDRIVE"); | |
97 char *homepath = getenv("HOMEPATH"); | |
98 QString home; | |
99 if (homedrive && homepath) { | |
100 home = QString("%1%2").arg(homedrive).arg(homepath); | |
101 } else { | |
102 home = QDir::home().absolutePath(); | |
103 } | |
104 if (home == "") return ""; | |
105 return QString("%1/.%2").arg(qApp->applicationName()); //!!! wrong | |
106 #else | |
95 char *home = getenv("HOME"); | 107 char *home = getenv("HOME"); |
96 if (!home || !home[0]) return ""; | 108 if (!home || !home[0]) return ""; |
97 | |
98 #ifdef Q_OS_WIN32 | |
99 return QString(); //!!!??? | |
100 #else | |
101 #ifdef Q_OS_MAC | 109 #ifdef Q_OS_MAC |
102 return QString("%1/Library/Application Support/%2/%3") | 110 return QString("%1/Library/Application Support/%2/%3") |
103 .arg(home) | 111 .arg(home) |
104 .arg(qApp->organizationName()) | 112 .arg(qApp->organizationName()) |
105 .arg(qApp->applicationName()); | 113 .arg(qApp->applicationName()); |