Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/corelib/io/qstandardpaths_unix.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||
2 | - | |||||||||||||
3 | - | |||||||||||||
4 | - | |||||||||||||
5 | - | |||||||||||||
6 | - | |||||||||||||
7 | - | |||||||||||||
8 | - | |||||||||||||
9 | - | |||||||||||||
10 | static void appendOrganizationAndApp(QString &path) | - | ||||||||||||
11 | { | - | ||||||||||||
12 | - | |||||||||||||
13 | const QString org = QCoreApplication::organizationName(); | - | ||||||||||||
14 | if (!org.isEmpty()
| 8-30 | ||||||||||||
15 | path += QLatin1Char('/') + org; executed 8 times by 1 test: path += QLatin1Char('/') + org; Executed by:
| 8 | ||||||||||||
16 | const QString appName = QCoreApplication::applicationName(); | - | ||||||||||||
17 | if (!appName.isEmpty()
| 0-38 | ||||||||||||
18 | path += QLatin1Char('/') + appName; executed 38 times by 1 test: path += QLatin1Char('/') + appName; Executed by:
| 38 | ||||||||||||
19 | - | |||||||||||||
20 | - | |||||||||||||
21 | - | |||||||||||||
22 | } executed 38 times by 1 test: end of block Executed by:
| 38 | ||||||||||||
23 | - | |||||||||||||
24 | QString QStandardPaths::writableLocation(StandardLocation type) | - | ||||||||||||
25 | { | - | ||||||||||||
26 | switch (type) { | - | ||||||||||||
27 | case executed 5 times by 1 test: HomeLocation:case HomeLocation: Executed by:
executed 5 times by 1 test: case HomeLocation: Executed by:
| 5 | ||||||||||||
28 | return executed 5 times by 1 test: QDir::homePath();return QDir::homePath(); Executed by:
executed 5 times by 1 test: return QDir::homePath(); Executed by:
| 5 | ||||||||||||
29 | case executed 5 times by 1 test: TempLocation:case TempLocation: Executed by:
executed 5 times by 1 test: case TempLocation: Executed by:
| 5 | ||||||||||||
30 | return executed 5 times by 1 test: QDir::tempPath();return QDir::tempPath(); Executed by:
executed 5 times by 1 test: return QDir::tempPath(); Executed by:
| 5 | ||||||||||||
31 | case executed 6 times by 1 test: CacheLocation:case CacheLocation: Executed by:
executed 6 times by 1 test: case CacheLocation: Executed by:
| 6 | ||||||||||||
32 | case executed 8 times by 1 test: GenericCacheLocation:case GenericCacheLocation: Executed by:
executed 8 times by 1 test: case GenericCacheLocation: Executed by:
| 8 | ||||||||||||
33 | { | - | ||||||||||||
34 | - | |||||||||||||
35 | QString xdgCacheHome = QFile::decodeName(qgetenv("XDG_CACHE_HOME")); | - | ||||||||||||
36 | if (isTestModeEnabled()
| 4-10 | ||||||||||||
37 | xdgCacheHome = QDir::homePath() + QLatin1String("/.qttest/cache"); executed 4 times by 1 test: xdgCacheHome = QDir::homePath() + QLatin1String("/.qttest/cache"); Executed by:
| 4 | ||||||||||||
38 | if (xdgCacheHome.isEmpty()
| 4-10 | ||||||||||||
39 | xdgCacheHome = QDir::homePath() + QLatin1String("/.cache"); executed 10 times by 1 test: xdgCacheHome = QDir::homePath() + QLatin1String("/.cache"); Executed by:
| 10 | ||||||||||||
40 | if (type == QStandardPaths::CacheLocation
| 6-8 | ||||||||||||
41 | appendOrganizationAndApp(xdgCacheHome); executed 6 times by 1 test: appendOrganizationAndApp(xdgCacheHome); Executed by:
| 6 | ||||||||||||
42 | return executed 14 times by 1 test: xdgCacheHome;return xdgCacheHome; Executed by:
executed 14 times by 1 test: return xdgCacheHome; Executed by:
| 14 | ||||||||||||
43 | } | - | ||||||||||||
44 | case executed 5 times by 1 test: AppDataLocation:case AppDataLocation: Executed by:
executed 5 times by 1 test: case AppDataLocation: Executed by:
| 5 | ||||||||||||
45 | case executed 13 times by 1 test: AppLocalDataLocation:case AppLocalDataLocation: Executed by:
executed 13 times by 1 test: case AppLocalDataLocation: Executed by:
| 13 | ||||||||||||
46 | case executed 2676 times by 26 tests: GenericDataLocation:case GenericDataLocation: Executed by:
executed 2676 times by 26 tests: case GenericDataLocation: Executed by:
| 2676 | ||||||||||||
47 | { | - | ||||||||||||
48 | QString xdgDataHome = QFile::decodeName(qgetenv("XDG_DATA_HOME")); | - | ||||||||||||
49 | if (isTestModeEnabled()
| 631-2063 | ||||||||||||
50 | xdgDataHome = QDir::homePath() + QLatin1String("/.qttest/share"); executed 2063 times by 4 tests: xdgDataHome = QDir::homePath() + QLatin1String("/.qttest/share"); Executed by:
| 2063 | ||||||||||||
51 | if (xdgDataHome.isEmpty()
| 620-2074 | ||||||||||||
52 | xdgDataHome = QDir::homePath() + QLatin1String("/.local/share"); executed 620 times by 23 tests: xdgDataHome = QDir::homePath() + QLatin1String("/.local/share"); Executed by:
| 620 | ||||||||||||
53 | if (type == AppDataLocation
| 5-2689 | ||||||||||||
54 | appendOrganizationAndApp(xdgDataHome); executed 18 times by 1 test: appendOrganizationAndApp(xdgDataHome); Executed by:
| 18 | ||||||||||||
55 | return executed 2694 times by 26 tests: xdgDataHome;return xdgDataHome; Executed by:
executed 2694 times by 26 tests: return xdgDataHome; Executed by:
| 2694 | ||||||||||||
56 | } | - | ||||||||||||
57 | case executed 16 times by 1 test: ConfigLocation:case ConfigLocation: Executed by:
executed 16 times by 1 test: case ConfigLocation: Executed by:
| 16 | ||||||||||||
58 | case executed 1098 times by 32 tests: GenericConfigLocation:case GenericConfigLocation: Executed by:
executed 1098 times by 32 tests: case GenericConfigLocation: Executed by:
| 1098 | ||||||||||||
59 | case executed 5 times by 1 test: AppConfigLocation:case AppConfigLocation: Executed by:
executed 5 times by 1 test: case AppConfigLocation: Executed by:
| 5 | ||||||||||||
60 | { | - | ||||||||||||
61 | - | |||||||||||||
62 | QString xdgConfigHome = QFile::decodeName(qgetenv("XDG_CONFIG_HOME")); | - | ||||||||||||
63 | if (isTestModeEnabled()
| 12-1107 | ||||||||||||
64 | xdgConfigHome = QDir::homePath() + QLatin1String("/.qttest/config"); executed 12 times by 5 tests: xdgConfigHome = QDir::homePath() + QLatin1String("/.qttest/config"); Executed by:
| 12 | ||||||||||||
65 | if (xdgConfigHome.isEmpty()
| 21-1098 | ||||||||||||
66 | xdgConfigHome = QDir::homePath() + QLatin1String("/.config"); executed 1098 times by 28 tests: xdgConfigHome = QDir::homePath() + QLatin1String("/.config"); Executed by:
| 1098 | ||||||||||||
67 | if (type == AppConfigLocation
| 5-1114 | ||||||||||||
68 | appendOrganizationAndApp(xdgConfigHome); executed 5 times by 1 test: appendOrganizationAndApp(xdgConfigHome); Executed by:
| 5 | ||||||||||||
69 | return executed 1119 times by 32 tests: xdgConfigHome;return xdgConfigHome; Executed by:
executed 1119 times by 32 tests: return xdgConfigHome; Executed by:
| 1119 | ||||||||||||
70 | } | - | ||||||||||||
71 | case executed 8 times by 1 test: RuntimeLocation:case RuntimeLocation: Executed by:
executed 8 times by 1 test: case RuntimeLocation: Executed by:
| 8 | ||||||||||||
72 | { | - | ||||||||||||
73 | const uid_t myUid = geteuid(); | - | ||||||||||||
74 | - | |||||||||||||
75 | QFileInfo fileInfo; | - | ||||||||||||
76 | QString xdgRuntimeDir = QFile::decodeName(qgetenv("XDG_RUNTIME_DIR")); | - | ||||||||||||
77 | if (xdgRuntimeDir.isEmpty()
| 0-8 | ||||||||||||
78 | const QString userName = QFileSystemEngine::resolveUserName(myUid); | - | ||||||||||||
79 | xdgRuntimeDir = QDir::tempPath() + QLatin1String("/runtime-") + userName; | - | ||||||||||||
80 | fileInfo.setFile(xdgRuntimeDir); | - | ||||||||||||
81 | if (!fileInfo.isDir()
| 0 | ||||||||||||
82 | if (!QDir().mkdir(xdgRuntimeDir)
| 0 | ||||||||||||
83 | QMessageLogger(__FILE__, 130, __PRETTY_FUNCTION__).warning("QStandardPaths: error creating runtime directory %s: %s", QString(xdgRuntimeDir).toLocal8Bit().constData(), QString(qt_error_string((*__errno_location ()))).toLocal8Bit().constData()); | - | ||||||||||||
84 | return never executed: QString();return QString(); never executed: return QString(); | 0 | ||||||||||||
85 | } | - | ||||||||||||
86 | } never executed: end of block | 0 | ||||||||||||
87 | QMessageLogger(__FILE__, 134, __PRETTY_FUNCTION__).warning("QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '%s'", QString(xdgRuntimeDir).toLocal8Bit().constData()); | - | ||||||||||||
88 | } never executed: else {end of block | 0 | ||||||||||||
89 | fileInfo.setFile(xdgRuntimeDir); | - | ||||||||||||
90 | if (!fileInfo.exists()
| 1-7 | ||||||||||||
91 | QMessageLogger(__FILE__, 138, __PRETTY_FUNCTION__).warning("QStandardPaths: XDG_RUNTIME_DIR points to non-existing path '%s', " | - | ||||||||||||
92 | "please create it with 0700 permissions.", QString(xdgRuntimeDir).toLocal8Bit().constData()); | - | ||||||||||||
93 | return executed 1 time by 1 test: QString();return QString(); Executed by:
executed 1 time by 1 test: return QString(); Executed by:
| 1 | ||||||||||||
94 | } | - | ||||||||||||
95 | if (!fileInfo.isDir()
| 1-6 | ||||||||||||
96 | QMessageLogger(__FILE__, 143, __PRETTY_FUNCTION__).warning("QStandardPaths: XDG_RUNTIME_DIR points to '%s' which is not a directory", | - | ||||||||||||
97 | QString(xdgRuntimeDir).toLocal8Bit().constData()); | - | ||||||||||||
98 | return executed 1 time by 1 test: QString();return QString(); Executed by:
executed 1 time by 1 test: return QString(); Executed by:
| 1 | ||||||||||||
99 | } | - | ||||||||||||
100 | } executed 6 times by 1 test: end of block Executed by:
| 6 | ||||||||||||
101 | - | |||||||||||||
102 | if (fileInfo.ownerId() != myUid
| 1-5 | ||||||||||||
103 | QMessageLogger(__FILE__, 150, __PRETTY_FUNCTION__).warning("QStandardPaths: wrong ownership on runtime directory %s, %d instead of %d", QString(xdgRuntimeDir).toLocal8Bit().constData(), | - | ||||||||||||
104 | fileInfo.ownerId(), myUid); | - | ||||||||||||
105 | return executed 1 time by 1 test: QString();return QString(); Executed by:
executed 1 time by 1 test: return QString(); Executed by:
| 1 | ||||||||||||
106 | } | - | ||||||||||||
107 | - | |||||||||||||
108 | - | |||||||||||||
109 | const QFile::Permissions wantedPerms = QFile::ReadUser | QFile::WriteUser | QFile::ExeUser | - | ||||||||||||
110 | | QFile::ReadOwner | QFile::WriteOwner | QFile::ExeOwner; | - | ||||||||||||
111 | if (fileInfo.permissions() != wantedPerms
| 1-4 | ||||||||||||
112 | QFile file(xdgRuntimeDir); | - | ||||||||||||
113 | if (!file.setPermissions(wantedPerms)
| 0-1 | ||||||||||||
114 | QMessageLogger(__FILE__, 161, __PRETTY_FUNCTION__).warning("QStandardPaths: could not set correct permissions on runtime directory %s: %s", | - | ||||||||||||
115 | QString(xdgRuntimeDir).toLocal8Bit().constData(), QString(file.errorString()).toLocal8Bit().constData()); | - | ||||||||||||
116 | return never executed: QString();return QString(); never executed: return QString(); | 0 | ||||||||||||
117 | } | - | ||||||||||||
118 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||
119 | return executed 5 times by 1 test: xdgRuntimeDir;return xdgRuntimeDir; Executed by:
executed 5 times by 1 test: return xdgRuntimeDir; Executed by:
| 5 | ||||||||||||
120 | } | - | ||||||||||||
121 | default executed 45 times by 3 tests: :default: Executed by:
executed 45 times by 3 tests: default: Executed by:
| 45 | ||||||||||||
122 | break; executed 45 times by 3 tests: break; Executed by:
| 45 | ||||||||||||
123 | } | - | ||||||||||||
124 | - | |||||||||||||
125 | - | |||||||||||||
126 | - | |||||||||||||
127 | QString xdgConfigHome = QFile::decodeName(qgetenv("XDG_CONFIG_HOME")); | - | ||||||||||||
128 | if (xdgConfigHome.isEmpty()
| 2-43 | ||||||||||||
129 | xdgConfigHome = QDir::homePath() + QLatin1String("/.config"); executed 43 times by 3 tests: xdgConfigHome = QDir::homePath() + QLatin1String("/.config"); Executed by:
| 43 | ||||||||||||
130 | QFile file(xdgConfigHome + QLatin1String("/user-dirs.dirs")); | - | ||||||||||||
131 | if (!isTestModeEnabled()
| 0-45 | ||||||||||||
132 | QHash<QString, QString> lines; | - | ||||||||||||
133 | QTextStream stream(&file); | - | ||||||||||||
134 | - | |||||||||||||
135 | QRegExp exp(QLatin1String("^XDG_(.*)_DIR=(.*)$")); | - | ||||||||||||
136 | while (!stream.atEnd()
| 43-645 | ||||||||||||
137 | const QString &line = stream.readLine(); | - | ||||||||||||
138 | if (exp.indexIn(line) != -1
| 301-344 | ||||||||||||
139 | const QStringList lst = exp.capturedTexts(); | - | ||||||||||||
140 | const QString key = lst.at(1); | - | ||||||||||||
141 | QString value = lst.at(2); | - | ||||||||||||
142 | if (value.length() > 2
| 0-344 | ||||||||||||
143 | && value.startsWith(QLatin1Char('\"'))
| 0-344 | ||||||||||||
144 | && value.endsWith(QLatin1Char('\"'))
| 0-344 | ||||||||||||
145 | value = value.mid(1, value.length() - 2); executed 344 times by 3 tests: value = value.mid(1, value.length() - 2); Executed by:
| 344 | ||||||||||||
146 | - | |||||||||||||
147 | lines[key] = value; | - | ||||||||||||
148 | } executed 344 times by 3 tests: end of block Executed by:
| 344 | ||||||||||||
149 | } executed 645 times by 3 tests: end of block Executed by:
| 645 | ||||||||||||
150 | - | |||||||||||||
151 | QString key; | - | ||||||||||||
152 | switch (type) { | - | ||||||||||||
153 | case executed 5 times by 1 test: DesktopLocation:case DesktopLocation: Executed by:
executed 5 times by 1 test: case DesktopLocation: Executed by:
| 5 | ||||||||||||
154 | key = QLatin1String("DESKTOP"); | - | ||||||||||||
155 | break; executed 5 times by 1 test: break; Executed by:
| 5 | ||||||||||||
156 | case executed 7 times by 2 tests: DocumentsLocation:case DocumentsLocation: Executed by:
executed 7 times by 2 tests: case DocumentsLocation: Executed by:
| 7 | ||||||||||||
157 | key = QLatin1String("DOCUMENTS"); | - | ||||||||||||
158 | break; executed 7 times by 2 tests: break; Executed by:
| 7 | ||||||||||||
159 | case executed 5 times by 1 test: PicturesLocation:case PicturesLocation: Executed by:
executed 5 times by 1 test: case PicturesLocation: Executed by:
| 5 | ||||||||||||
160 | key = QLatin1String("PICTURES"); | - | ||||||||||||
161 | break; executed 5 times by 1 test: break; Executed by:
| 5 | ||||||||||||
162 | case executed 5 times by 1 test: MusicLocation:case MusicLocation: Executed by:
executed 5 times by 1 test: case MusicLocation: Executed by:
| 5 | ||||||||||||
163 | key = QLatin1String("MUSIC"); | - | ||||||||||||
164 | break; executed 5 times by 1 test: break; Executed by:
| 5 | ||||||||||||
165 | case executed 5 times by 1 test: MoviesLocation:case MoviesLocation: Executed by:
executed 5 times by 1 test: case MoviesLocation: Executed by:
| 5 | ||||||||||||
166 | key = QLatin1String("VIDEOS"); | - | ||||||||||||
167 | break; executed 5 times by 1 test: break; Executed by:
| 5 | ||||||||||||
168 | case executed 6 times by 2 tests: DownloadLocation:case DownloadLocation: Executed by:
executed 6 times by 2 tests: case DownloadLocation: Executed by:
| 6 | ||||||||||||
169 | key = QLatin1String("DOWNLOAD"); | - | ||||||||||||
170 | break; executed 6 times by 2 tests: break; Executed by:
| 6 | ||||||||||||
171 | default executed 10 times by 1 test: :default: Executed by:
executed 10 times by 1 test: default: Executed by:
| 10 | ||||||||||||
172 | break; executed 10 times by 1 test: break; Executed by:
| 10 | ||||||||||||
173 | } | - | ||||||||||||
174 | if (!key.isEmpty()
| 10-33 | ||||||||||||
175 | QString value = lines.value(key); | - | ||||||||||||
176 | if (!value.isEmpty()
| 0-33 | ||||||||||||
177 | - | |||||||||||||
178 | if (value.startsWith(QLatin1String("$HOME"))
| 0-33 | ||||||||||||
179 | value = QDir::homePath() + value.mid(5); executed 33 times by 3 tests: value = QDir::homePath() + value.mid(5); Executed by:
| 33 | ||||||||||||
180 | if (value.length() > 1
| 0-33 | ||||||||||||
181 | value.chop(1); never executed: value.chop(1); | 0 | ||||||||||||
182 | return executed 33 times by 3 tests: value;return value; Executed by:
executed 33 times by 3 tests: return value; Executed by:
| 33 | ||||||||||||
183 | } | - | ||||||||||||
184 | } never executed: end of block | 0 | ||||||||||||
185 | } executed 10 times by 1 test: end of block Executed by:
| 10 | ||||||||||||
186 | - | |||||||||||||
187 | - | |||||||||||||
188 | QString path; | - | ||||||||||||
189 | switch (type) { | - | ||||||||||||
190 | case never executed: DesktopLocation:case DesktopLocation: never executed: case DesktopLocation: | 0 | ||||||||||||
191 | path = QDir::homePath() + QLatin1String("/Desktop"); | - | ||||||||||||
192 | break; never executed: break; | 0 | ||||||||||||
193 | case never executed: DocumentsLocation:case DocumentsLocation: never executed: case DocumentsLocation: | 0 | ||||||||||||
194 | path = QDir::homePath() + QLatin1String("/Documents"); | - | ||||||||||||
195 | break; never executed: break; | 0 | ||||||||||||
196 | case never executed: PicturesLocation:case PicturesLocation: never executed: case PicturesLocation: | 0 | ||||||||||||
197 | path = QDir::homePath() + QLatin1String("/Pictures"); | - | ||||||||||||
198 | break; never executed: break; | 0 | ||||||||||||
199 | - | |||||||||||||
200 | case executed 5 times by 1 test: FontsLocation:case FontsLocation: Executed by:
executed 5 times by 1 test: case FontsLocation: Executed by:
| 5 | ||||||||||||
201 | path = QDir::homePath() + QLatin1String("/.fonts"); | - | ||||||||||||
202 | break; executed 5 times by 1 test: break; Executed by:
| 5 | ||||||||||||
203 | - | |||||||||||||
204 | case never executed: MusicLocation:case MusicLocation: never executed: case MusicLocation: | 0 | ||||||||||||
205 | path = QDir::homePath() + QLatin1String("/Music"); | - | ||||||||||||
206 | break; never executed: break; | 0 | ||||||||||||
207 | - | |||||||||||||
208 | case never executed: MoviesLocation:case MoviesLocation: never executed: case MoviesLocation: | 0 | ||||||||||||
209 | path = QDir::homePath() + QLatin1String("/Videos"); | - | ||||||||||||
210 | break; never executed: break; | 0 | ||||||||||||
211 | case never executed: DownloadLocation:case DownloadLocation: never executed: case DownloadLocation: | 0 | ||||||||||||
212 | path = QDir::homePath() + QLatin1String("/Downloads"); | - | ||||||||||||
213 | break; never executed: break; | 0 | ||||||||||||
214 | case executed 7 times by 1 test: ApplicationsLocation:case ApplicationsLocation: Executed by:
executed 7 times by 1 test: case ApplicationsLocation: Executed by:
| 7 | ||||||||||||
215 | path = writableLocation(GenericDataLocation) + QLatin1String("/applications"); | - | ||||||||||||
216 | break; executed 7 times by 1 test: break; Executed by:
| 7 | ||||||||||||
217 | - | |||||||||||||
218 | default never executed: :default: never executed: default: | 0 | ||||||||||||
219 | break; never executed: break; | 0 | ||||||||||||
220 | } | - | ||||||||||||
221 | - | |||||||||||||
222 | return executed 12 times by 1 test: path;return path; Executed by:
executed 12 times by 1 test: return path; Executed by:
| 12 | ||||||||||||
223 | } | - | ||||||||||||
224 | - | |||||||||||||
225 | static QStringList xdgDataDirs() | - | ||||||||||||
226 | { | - | ||||||||||||
227 | QStringList dirs; | - | ||||||||||||
228 | - | |||||||||||||
229 | QString xdgDataDirsEnv = QFile::decodeName(qgetenv("XDG_DATA_DIRS")); | - | ||||||||||||
230 | if (xdgDataDirsEnv.isEmpty()
| 141-2501 | ||||||||||||
231 | dirs.append(QString::fromLatin1("/usr/local/share")); | - | ||||||||||||
232 | dirs.append(QString::fromLatin1("/usr/share")); | - | ||||||||||||
233 | } executed 2501 times by 23 tests: else {end of block Executed by:
| 2501 | ||||||||||||
234 | dirs = xdgDataDirsEnv.split(QLatin1Char(':'), QString::SkipEmptyParts); | - | ||||||||||||
235 | - | |||||||||||||
236 | - | |||||||||||||
237 | QMutableListIterator<QString> it(dirs); | - | ||||||||||||
238 | while (it.hasNext()
| 141-142 | ||||||||||||
239 | const QString dir = it.next(); | - | ||||||||||||
240 | if (!dir.startsWith(QLatin1Char('/'))
| 2-140 | ||||||||||||
241 | it.remove(); executed 2 times by 2 tests: it.remove(); Executed by:
| 2 | ||||||||||||
242 | else | - | ||||||||||||
243 | it.setValue(QDir::cleanPath(dir)); executed 140 times by 2 tests: it.setValue(QDir::cleanPath(dir)); Executed by:
| 140 | ||||||||||||
244 | } | - | ||||||||||||
245 | - | |||||||||||||
246 | - | |||||||||||||
247 | - | |||||||||||||
248 | - | |||||||||||||
249 | - | |||||||||||||
250 | - | |||||||||||||
251 | - | |||||||||||||
252 | dirs.removeDuplicates(); | - | ||||||||||||
253 | } executed 141 times by 3 tests: end of block Executed by:
| 141 | ||||||||||||
254 | return executed 2642 times by 25 tests: dirs;return dirs; Executed by:
executed 2642 times by 25 tests: return dirs; Executed by:
| 2642 | ||||||||||||
255 | } | - | ||||||||||||
256 | - | |||||||||||||
257 | static QStringList xdgConfigDirs() | - | ||||||||||||
258 | { | - | ||||||||||||
259 | QStringList dirs; | - | ||||||||||||
260 | - | |||||||||||||
261 | const QString xdgConfigDirs = QFile::decodeName(qgetenv("XDG_CONFIG_DIRS")); | - | ||||||||||||
262 | if (xdgConfigDirs.isEmpty()
| 6-1086 | ||||||||||||
263 | dirs.append(QString::fromLatin1("/etc/xdg")); executed 1086 times by 25 tests: dirs.append(QString::fromLatin1("/etc/xdg")); Executed by:
| 1086 | ||||||||||||
264 | else | - | ||||||||||||
265 | dirs = xdgConfigDirs.split(QLatin1Char(':')); executed 6 times by 1 test: dirs = xdgConfigDirs.split(QLatin1Char(':')); Executed by:
| 6 | ||||||||||||
266 | return executed 1092 times by 25 tests: dirs;return dirs; Executed by:
executed 1092 times by 25 tests: return dirs; Executed by:
| 1092 | ||||||||||||
267 | } | - | ||||||||||||
268 | - | |||||||||||||
269 | QStringList QStandardPaths::standardLocations(StandardLocation type) | - | ||||||||||||
270 | { | - | ||||||||||||
271 | QStringList dirs; | - | ||||||||||||
272 | switch (type) { | - | ||||||||||||
273 | case executed 9 times by 1 test: ConfigLocation:case ConfigLocation: Executed by:
executed 9 times by 1 test: case ConfigLocation: Executed by:
| 9 | ||||||||||||
274 | case executed 1082 times by 25 tests: GenericConfigLocation:case GenericConfigLocation: Executed by:
executed 1082 times by 25 tests: case GenericConfigLocation: Executed by:
| 1082 | ||||||||||||
275 | dirs = xdgConfigDirs(); | - | ||||||||||||
276 | break; executed 1091 times by 25 tests: break; Executed by:
| 1091 | ||||||||||||
277 | case executed 1 time by 1 test: AppConfigLocation:case AppConfigLocation: Executed by:
executed 1 time by 1 test: case AppConfigLocation: Executed by:
| 1 | ||||||||||||
278 | dirs = xdgConfigDirs(); | - | ||||||||||||
279 | for (int i = 0; i < dirs.count()
| 1 | ||||||||||||
280 | appendOrganizationAndApp(dirs[i]); executed 1 time by 1 test: appendOrganizationAndApp(dirs[i]); Executed by:
| 1 | ||||||||||||
281 | break; executed 1 time by 1 test: break; Executed by:
| 1 | ||||||||||||
282 | case executed 2634 times by 25 tests: GenericDataLocation:case GenericDataLocation: Executed by:
executed 2634 times by 25 tests: case GenericDataLocation: Executed by:
| 2634 | ||||||||||||
283 | dirs = xdgDataDirs(); | - | ||||||||||||
284 | break; executed 2634 times by 25 tests: break; Executed by:
| 2634 | ||||||||||||
285 | case executed 4 times by 1 test: ApplicationsLocation:case ApplicationsLocation: Executed by:
executed 4 times by 1 test: case ApplicationsLocation: Executed by:
| 4 | ||||||||||||
286 | dirs = xdgDataDirs(); | - | ||||||||||||
287 | for (int i = 0; i < dirs.count()
| 4-6 | ||||||||||||
288 | dirs[i].append(QLatin1String("/applications")); executed 6 times by 1 test: dirs[i].append(QLatin1String("/applications")); Executed by:
| 6 | ||||||||||||
289 | break; executed 4 times by 1 test: break; Executed by:
| 4 | ||||||||||||
290 | case executed 1 time by 1 test: AppDataLocation:case AppDataLocation: Executed by:
executed 1 time by 1 test: case AppDataLocation: Executed by:
| 1 | ||||||||||||
291 | case executed 3 times by 1 test: AppLocalDataLocation:case AppLocalDataLocation: Executed by:
executed 3 times by 1 test: case AppLocalDataLocation: Executed by:
| 3 | ||||||||||||
292 | dirs = xdgDataDirs(); | - | ||||||||||||
293 | for (int i = 0; i < dirs.count()
| 4-8 | ||||||||||||
294 | appendOrganizationAndApp(dirs[i]); executed 8 times by 1 test: appendOrganizationAndApp(dirs[i]); Executed by:
| 8 | ||||||||||||
295 | break; executed 4 times by 1 test: break; Executed by:
| 4 | ||||||||||||
296 | default executed 27 times by 2 tests: :default: Executed by:
executed 27 times by 2 tests: default: Executed by:
| 27 | ||||||||||||
297 | break; executed 27 times by 2 tests: break; Executed by:
| 27 | ||||||||||||
298 | } | - | ||||||||||||
299 | const QString localDir = writableLocation(type); | - | ||||||||||||
300 | dirs.prepend(localDir); | - | ||||||||||||
301 | return executed 3761 times by 48 tests: dirs;return dirs; Executed by:
executed 3761 times by 48 tests: return dirs; Executed by:
| 3761 | ||||||||||||
302 | } | - | ||||||||||||
303 | - | |||||||||||||
304 | - | |||||||||||||
Switch to Source code | Preprocessed file |