Mercurial > hg > svcore
comparison base/ResourceFinder.cpp @ 1480:5ac102155409 plugin-path-config
Environment variable lookup fixes, & use this implementation throughout
author | Chris Cannam |
---|---|
date | Fri, 08 Jun 2018 11:27:40 +0100 |
parents | e1926cba940c |
children | 57833933cc75 |
comparison
equal
deleted
inserted
replaced
1479:ba27edcd6102 | 1480:5ac102155409 |
---|---|
33 | 33 |
34 #include <cstdlib> | 34 #include <cstdlib> |
35 #include <iostream> | 35 #include <iostream> |
36 #include <stdexcept> | 36 #include <stdexcept> |
37 | 37 |
38 #include "system/System.h" | |
39 | |
38 /** | 40 /** |
39 Resource files may be found in three places: | 41 Resource files may be found in three places: |
40 | 42 |
41 * Bundled into the application as Qt4 resources. These may be | 43 * Bundled into the application as Qt4 resources. These may be |
42 opened using Qt classes such as QFile, with "fake" file paths | 44 opened using Qt classes such as QFile, with "fake" file paths |
65 // returned in order of priority | 67 // returned in order of priority |
66 | 68 |
67 QStringList list; | 69 QStringList list; |
68 | 70 |
69 #ifdef Q_OS_WIN32 | 71 #ifdef Q_OS_WIN32 |
70 char *programFiles = getenv("ProgramFiles"); | 72 std::string programFiles; |
71 if (programFiles && programFiles[0]) { | 73 (void)getEnvUtf8("ProgramFiles", programFiles); |
74 if (programFiles != "") { | |
72 list << QString("%1/%2/%3") | 75 list << QString("%1/%2/%3") |
73 .arg(programFiles) | 76 .arg(QString::fromStdString(programFiles)) |
74 .arg(qApp->organizationName()) | 77 .arg(qApp->organizationName()) |
75 .arg(qApp->applicationName()); | 78 .arg(qApp->applicationName()); |
76 } else { | 79 } else { |
77 list << QString("C:/Program Files/%1/%2") | 80 list << QString("C:/Program Files/%1/%2") |
78 .arg(qApp->organizationName()) | 81 .arg(qApp->organizationName()) |