| Line | Source Code | Coverage |
|---|
| 1 | /**************************************************************************** | - |
| 2 | ** | - |
| 3 | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). | - |
| 4 | ** Contact: http://www.qt-project.org/legal | - |
| 5 | ** | - |
| 6 | ** This file is part of the QtCore module of the Qt Toolkit. | - |
| 7 | ** | - |
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ | - |
| 9 | ** Commercial License Usage | - |
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in | - |
| 11 | ** accordance with the commercial license agreement provided with the | - |
| 12 | ** Software or, alternatively, in accordance with the terms contained in | - |
| 13 | ** a written agreement between you and Digia. For licensing terms and | - |
| 14 | ** conditions see http://qt.digia.com/licensing. For further information | - |
| 15 | ** use the contact form at http://qt.digia.com/contact-us. | - |
| 16 | ** | - |
| 17 | ** GNU Lesser General Public License Usage | - |
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - |
| 19 | ** General Public License version 2.1 as published by the Free Software | - |
| 20 | ** Foundation and appearing in the file LICENSE.LGPL included in the | - |
| 21 | ** packaging of this file. Please review the following information to | - |
| 22 | ** ensure the GNU Lesser General Public License version 2.1 requirements | - |
| 23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - |
| 24 | ** | - |
| 25 | ** In addition, as a special exception, Digia gives you certain additional | - |
| 26 | ** rights. These rights are described in the Digia Qt LGPL Exception | - |
| 27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - |
| 28 | ** | - |
| 29 | ** GNU General Public License Usage | - |
| 30 | ** Alternatively, this file may be used under the terms of the GNU | - |
| 31 | ** General Public License version 3.0 as published by the Free Software | - |
| 32 | ** Foundation and appearing in the file LICENSE.GPL included in the | - |
| 33 | ** packaging of this file. Please review the following information to | - |
| 34 | ** ensure the GNU General Public License version 3.0 requirements will be | - |
| 35 | ** met: http://www.gnu.org/copyleft/gpl.html. | - |
| 36 | ** | - |
| 37 | ** | - |
| 38 | ** $QT_END_LICENSE$ | - |
| 39 | ** | - |
| 40 | ****************************************************************************/ | - |
| 41 | | - |
| 42 | #include "qstandardpaths.h" | - |
| 43 | #include <qdir.h> | - |
| 44 | #include <qfile.h> | - |
| 45 | #include <qhash.h> | - |
| 46 | #include <qtextstream.h> | - |
| 47 | #include <private/qfilesystemengine_p.h> | - |
| 48 | #include <errno.h> | - |
| 49 | #include <stdlib.h> | - |
| 50 | | - |
| 51 | #ifndef QT_BOOTSTRAPPED | - |
| 52 | #include <qcoreapplication.h> | - |
| 53 | #endif | - |
| 54 | | - |
| 55 | #ifndef QT_NO_STANDARDPATHS | - |
| 56 | | - |
| 57 | QT_BEGIN_NAMESPACE | - |
| 58 | | - |
| 59 | static void appendOrganizationAndApp(QString &path) | - |
| 60 | { | - |
| 61 | #ifndef QT_BOOTSTRAPPED | - |
| 62 | const QString org = QCoreApplication::organizationName(); executed (the execution status of this line is deduced): const QString org = QCoreApplication::organizationName(); | - |
| 63 | if (!org.isEmpty()) evaluated: !org.isEmpty()| yes Evaluation Count:8 | yes Evaluation Count:7 |
| 7-8 |
| 64 | path += QLatin1Char('/') + org; executed: path += QLatin1Char('/') + org;Execution Count:8 | 8 |
| 65 | const QString appName = QCoreApplication::applicationName(); executed (the execution status of this line is deduced): const QString appName = QCoreApplication::applicationName(); | - |
| 66 | if (!appName.isEmpty()) partially evaluated: !appName.isEmpty()| yes Evaluation Count:15 | no Evaluation Count:0 |
| 0-15 |
| 67 | path += QLatin1Char('/') + appName; executed: path += QLatin1Char('/') + appName;Execution Count:15 | 15 |
| 68 | #else | - |
| 69 | Q_UNUSED(path); | - |
| 70 | #endif | - |
| 71 | } executed: }Execution Count:15 | 15 |
| 72 | | - |
| 73 | QString QStandardPaths::writableLocation(StandardLocation type) | - |
| 74 | { | - |
| 75 | switch (type) { | - |
| 76 | case HomeLocation: | - |
| 77 | return QDir::homePath(); executed: return QDir::homePath();Execution Count:2 | 2 |
| 78 | case TempLocation: | - |
| 79 | return QDir::tempPath(); executed: return QDir::tempPath();Execution Count:2 | 2 |
| 80 | case CacheLocation: | - |
| 81 | case GenericCacheLocation: | - |
| 82 | { | - |
| 83 | // http://standards.freedesktop.org/basedir-spec/basedir-spec-0.6.html | - |
| 84 | QString xdgCacheHome = QFile::decodeName(qgetenv("XDG_CACHE_HOME")); executed (the execution status of this line is deduced): QString xdgCacheHome = QFile::decodeName(qgetenv("XDG_CACHE_HOME")); | - |
| 85 | if (isTestModeEnabled()) evaluated: isTestModeEnabled()| yes Evaluation Count:4 | yes Evaluation Count:4 |
| 4 |
| 86 | xdgCacheHome = QDir::homePath() + QLatin1String("/.qttest/cache"); executed: xdgCacheHome = QDir::homePath() + QLatin1String("/.qttest/cache");Execution Count:4 | 4 |
| 87 | if (xdgCacheHome.isEmpty()) evaluated: xdgCacheHome.isEmpty()| yes Evaluation Count:4 | yes Evaluation Count:4 |
| 4 |
| 88 | xdgCacheHome = QDir::homePath() + QLatin1String("/.cache"); executed: xdgCacheHome = QDir::homePath() + QLatin1String("/.cache");Execution Count:4 | 4 |
| 89 | if (type == QStandardPaths::CacheLocation) evaluated: type == QStandardPaths::CacheLocation| yes Evaluation Count:3 | yes Evaluation Count:5 |
| 3-5 |
| 90 | appendOrganizationAndApp(xdgCacheHome); executed: appendOrganizationAndApp(xdgCacheHome);Execution Count:3 | 3 |
| 91 | return xdgCacheHome; executed: return xdgCacheHome;Execution Count:8 | 8 |
| 92 | } | - |
| 93 | case DataLocation: | - |
| 94 | case GenericDataLocation: | - |
| 95 | { | - |
| 96 | QString xdgDataHome = QFile::decodeName(qgetenv("XDG_DATA_HOME")); executed (the execution status of this line is deduced): QString xdgDataHome = QFile::decodeName(qgetenv("XDG_DATA_HOME")); | - |
| 97 | if (isTestModeEnabled()) evaluated: isTestModeEnabled()| yes Evaluation Count:4 | yes Evaluation Count:81 |
| 4-81 |
| 98 | xdgDataHome = QDir::homePath() + QLatin1String("/.qttest/share"); executed: xdgDataHome = QDir::homePath() + QLatin1String("/.qttest/share");Execution Count:4 | 4 |
| 99 | if (xdgDataHome.isEmpty()) evaluated: xdgDataHome.isEmpty()| yes Evaluation Count:13 | yes Evaluation Count:72 |
| 13-72 |
| 100 | xdgDataHome = QDir::homePath() + QLatin1String("/.local/share"); executed: xdgDataHome = QDir::homePath() + QLatin1String("/.local/share");Execution Count:13 | 13 |
| 101 | if (type == QStandardPaths::DataLocation) evaluated: type == QStandardPaths::DataLocation| yes Evaluation Count:10 | yes Evaluation Count:75 |
| 10-75 |
| 102 | appendOrganizationAndApp(xdgDataHome); executed: appendOrganizationAndApp(xdgDataHome);Execution Count:10 | 10 |
| 103 | return xdgDataHome; executed: return xdgDataHome;Execution Count:85 | 85 |
| 104 | } | - |
| 105 | case ConfigLocation: | - |
| 106 | { | - |
| 107 | // http://standards.freedesktop.org/basedir-spec/latest/ | - |
| 108 | QString xdgConfigHome = QFile::decodeName(qgetenv("XDG_CONFIG_HOME")); executed (the execution status of this line is deduced): QString xdgConfigHome = QFile::decodeName(qgetenv("XDG_CONFIG_HOME")); | - |
| 109 | if (isTestModeEnabled()) evaluated: isTestModeEnabled()| yes Evaluation Count:3 | yes Evaluation Count:10 |
| 3-10 |
| 110 | xdgConfigHome = QDir::homePath() + QLatin1String("/.qttest/config"); executed: xdgConfigHome = QDir::homePath() + QLatin1String("/.qttest/config");Execution Count:3 | 3 |
| 111 | if (xdgConfigHome.isEmpty()) evaluated: xdgConfigHome.isEmpty()| yes Evaluation Count:3 | yes Evaluation Count:10 |
| 3-10 |
| 112 | xdgConfigHome = QDir::homePath() + QLatin1String("/.config"); executed: xdgConfigHome = QDir::homePath() + QLatin1String("/.config");Execution Count:3 | 3 |
| 113 | return xdgConfigHome; executed: return xdgConfigHome;Execution Count:13 | 13 |
| 114 | } | - |
| 115 | case RuntimeLocation: | - |
| 116 | { | - |
| 117 | const uid_t myUid = geteuid(); executed (the execution status of this line is deduced): const uid_t myUid = geteuid(); | - |
| 118 | // http://standards.freedesktop.org/basedir-spec/latest/ | - |
| 119 | QString xdgRuntimeDir = QFile::decodeName(qgetenv("XDG_RUNTIME_DIR")); executed (the execution status of this line is deduced): QString xdgRuntimeDir = QFile::decodeName(qgetenv("XDG_RUNTIME_DIR")); | - |
| 120 | if (xdgRuntimeDir.isEmpty()) { evaluated: xdgRuntimeDir.isEmpty()| yes Evaluation Count:2 | yes Evaluation Count:1 |
| 1-2 |
| 121 | const QString userName = QFileSystemEngine::resolveUserName(myUid); executed (the execution status of this line is deduced): const QString userName = QFileSystemEngine::resolveUserName(myUid); | - |
| 122 | xdgRuntimeDir = QDir::tempPath() + QLatin1String("/runtime-") + userName; executed (the execution status of this line is deduced): xdgRuntimeDir = QDir::tempPath() + QLatin1String("/runtime-") + userName; | - |
| 123 | QDir dir(xdgRuntimeDir); executed (the execution status of this line is deduced): QDir dir(xdgRuntimeDir); | - |
| 124 | if (!dir.exists()) { partially evaluated: !dir.exists()| no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
| 125 | if (!QDir().mkdir(xdgRuntimeDir)) { never evaluated: !QDir().mkdir(xdgRuntimeDir) | 0 |
| 126 | qWarning("QStandardPaths: error creating runtime directory %s: %s", qPrintable(xdgRuntimeDir), qPrintable(qt_error_string(errno))); never executed (the execution status of this line is deduced): QMessageLogger("io/qstandardpaths_unix.cpp", 126, __PRETTY_FUNCTION__).warning("QStandardPaths: error creating runtime directory %s: %s", QString(xdgRuntimeDir).toLocal8Bit().constData(), QString(qt_error_string((*__errno_location ()))).toLocal8Bit().constData()); | - |
| 127 | return QString(); never executed: return QString(); | 0 |
| 128 | } | - |
| 129 | } | 0 |
| 130 | qWarning("QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '%s'", qPrintable(xdgRuntimeDir)); executed (the execution status of this line is deduced): QMessageLogger("io/qstandardpaths_unix.cpp", 130, __PRETTY_FUNCTION__).warning("QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '%s'", QString(xdgRuntimeDir).toLocal8Bit().constData()); | - |
| 131 | } executed: }Execution Count:2 | 2 |
| 132 | // "The directory MUST be owned by the user" | - |
| 133 | QFileInfo fileInfo(xdgRuntimeDir); executed (the execution status of this line is deduced): QFileInfo fileInfo(xdgRuntimeDir); | - |
| 134 | if (fileInfo.ownerId() != myUid) { evaluated: fileInfo.ownerId() != myUid| yes Evaluation Count:1 | yes Evaluation Count:2 |
| 1-2 |
| 135 | qWarning("QStandardPaths: wrong ownership on runtime directory %s, %d instead of %d", qPrintable(xdgRuntimeDir), executed (the execution status of this line is deduced): QMessageLogger("io/qstandardpaths_unix.cpp", 135, __PRETTY_FUNCTION__).warning("QStandardPaths: wrong ownership on runtime directory %s, %d instead of %d", QString(xdgRuntimeDir).toLocal8Bit().constData(), | - |
| 136 | fileInfo.ownerId(), myUid); executed (the execution status of this line is deduced): fileInfo.ownerId(), myUid); | - |
| 137 | return QString(); executed: return QString();Execution Count:1 | 1 |
| 138 | } | - |
| 139 | // "and he MUST be the only one having read and write access to it. Its Unix access mode MUST be 0700." | - |
| 140 | QFile file(xdgRuntimeDir); executed (the execution status of this line is deduced): QFile file(xdgRuntimeDir); | - |
| 141 | const QFile::Permissions wantedPerms = QFile::ReadUser | QFile::WriteUser | QFile::ExeUser; executed (the execution status of this line is deduced): const QFile::Permissions wantedPerms = QFile::ReadUser | QFile::WriteUser | QFile::ExeUser; | - |
| 142 | if (file.permissions() != wantedPerms && !file.setPermissions(wantedPerms)) { partially evaluated: file.permissions() != wantedPerms| yes Evaluation Count:2 | no Evaluation Count:0 |
partially evaluated: !file.setPermissions(wantedPerms)| no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
| 143 | qWarning("QStandardPaths: wrong permissions on runtime directory %s", qPrintable(xdgRuntimeDir)); never executed (the execution status of this line is deduced): QMessageLogger("io/qstandardpaths_unix.cpp", 143, __PRETTY_FUNCTION__).warning("QStandardPaths: wrong permissions on runtime directory %s", QString(xdgRuntimeDir).toLocal8Bit().constData()); | - |
| 144 | return QString(); never executed: return QString(); | 0 |
| 145 | } | - |
| 146 | return xdgRuntimeDir; executed: return xdgRuntimeDir;Execution Count:2 | 2 |
| 147 | } | - |
| 148 | default: | - |
| 149 | break; executed: break;Execution Count:17 | 17 |
| 150 | } | - |
| 151 | | - |
| 152 | #ifndef QT_BOOTSTRAPPED | - |
| 153 | // http://www.freedesktop.org/wiki/Software/xdg-user-dirs | - |
| 154 | QString xdgConfigHome = QFile::decodeName(qgetenv("XDG_CONFIG_HOME")); executed (the execution status of this line is deduced): QString xdgConfigHome = QFile::decodeName(qgetenv("XDG_CONFIG_HOME")); | - |
| 155 | if (xdgConfigHome.isEmpty()) evaluated: xdgConfigHome.isEmpty()| yes Evaluation Count:16 | yes Evaluation Count:1 |
| 1-16 |
| 156 | xdgConfigHome = QDir::homePath() + QLatin1String("/.config"); executed: xdgConfigHome = QDir::homePath() + QLatin1String("/.config");Execution Count:16 | 16 |
| 157 | QFile file(xdgConfigHome + QLatin1String("/user-dirs.dirs")); executed (the execution status of this line is deduced): QFile file(xdgConfigHome + QLatin1String("/user-dirs.dirs")); | - |
| 158 | if (!isTestModeEnabled() && file.open(QIODevice::ReadOnly)) { partially evaluated: !isTestModeEnabled()| yes Evaluation Count:17 | no Evaluation Count:0 |
partially evaluated: file.open(QIODevice::ReadOnly)| no Evaluation Count:0 | yes Evaluation Count:17 |
| 0-17 |
| 159 | QHash<QString, QString> lines; never executed (the execution status of this line is deduced): QHash<QString, QString> lines; | - |
| 160 | QTextStream stream(&file); never executed (the execution status of this line is deduced): QTextStream stream(&file); | - |
| 161 | // Only look for lines like: XDG_DESKTOP_DIR="$HOME/Desktop" | - |
| 162 | QRegExp exp(QLatin1String("^XDG_(.*)_DIR=(.*)$")); never executed (the execution status of this line is deduced): QRegExp exp(QLatin1String("^XDG_(.*)_DIR=(.*)$")); | - |
| 163 | while (!stream.atEnd()) { never evaluated: !stream.atEnd() | 0 |
| 164 | const QString &line = stream.readLine(); never executed (the execution status of this line is deduced): const QString &line = stream.readLine(); | - |
| 165 | if (exp.indexIn(line) != -1) { never evaluated: exp.indexIn(line) != -1 | 0 |
| 166 | const QStringList lst = exp.capturedTexts(); never executed (the execution status of this line is deduced): const QStringList lst = exp.capturedTexts(); | - |
| 167 | const QString key = lst.at(1); never executed (the execution status of this line is deduced): const QString key = lst.at(1); | - |
| 168 | QString value = lst.at(2); never executed (the execution status of this line is deduced): QString value = lst.at(2); | - |
| 169 | if (value.length() > 2 never evaluated: value.length() > 2 | 0 |
| 170 | && value.startsWith(QLatin1Char('\"')) never evaluated: value.startsWith(QLatin1Char('\"')) | 0 |
| 171 | && value.endsWith(QLatin1Char('\"'))) never evaluated: value.endsWith(QLatin1Char('\"')) | 0 |
| 172 | value = value.mid(1, value.length() - 2); never executed: value = value.mid(1, value.length() - 2); | 0 |
| 173 | // Store the key and value: "DESKTOP", "$HOME/Desktop" | - |
| 174 | lines[key] = value; never executed (the execution status of this line is deduced): lines[key] = value; | - |
| 175 | } | 0 |
| 176 | } | 0 |
| 177 | | - |
| 178 | QString key; never executed (the execution status of this line is deduced): QString key; | - |
| 179 | switch (type) { | - |
| 180 | case DesktopLocation: | - |
| 181 | key = QLatin1String("DESKTOP"); never executed (the execution status of this line is deduced): key = QLatin1String("DESKTOP"); | - |
| 182 | break; | 0 |
| 183 | case DocumentsLocation: | - |
| 184 | key = QLatin1String("DOCUMENTS"); never executed (the execution status of this line is deduced): key = QLatin1String("DOCUMENTS"); | - |
| 185 | break; | 0 |
| 186 | case PicturesLocation: | - |
| 187 | key = QLatin1String("PICTURES"); never executed (the execution status of this line is deduced): key = QLatin1String("PICTURES"); | - |
| 188 | break; | 0 |
| 189 | case MusicLocation: | - |
| 190 | key = QLatin1String("MUSIC"); never executed (the execution status of this line is deduced): key = QLatin1String("MUSIC"); | - |
| 191 | break; | 0 |
| 192 | case MoviesLocation: | - |
| 193 | key = QLatin1String("VIDEOS"); never executed (the execution status of this line is deduced): key = QLatin1String("VIDEOS"); | - |
| 194 | break; | 0 |
| 195 | case DownloadLocation: | - |
| 196 | key = QLatin1String("DOWNLOAD"); never executed (the execution status of this line is deduced): key = QLatin1String("DOWNLOAD"); | - |
| 197 | break; | 0 |
| 198 | default: | - |
| 199 | break; | 0 |
| 200 | } | - |
| 201 | if (!key.isEmpty()) { never evaluated: !key.isEmpty() | 0 |
| 202 | QString value = lines.value(key); never executed (the execution status of this line is deduced): QString value = lines.value(key); | - |
| 203 | if (!value.isEmpty()) { never evaluated: !value.isEmpty() | 0 |
| 204 | // value can start with $HOME | - |
| 205 | if (value.startsWith(QLatin1String("$HOME"))) never evaluated: value.startsWith(QLatin1String("$HOME")) | 0 |
| 206 | value = QDir::homePath() + value.mid(5); never executed: value = QDir::homePath() + value.mid(5); | 0 |
| 207 | return value; never executed: return value; | 0 |
| 208 | } | - |
| 209 | } | 0 |
| 210 | } | 0 |
| 211 | #endif | - |
| 212 | | - |
| 213 | QString path; executed (the execution status of this line is deduced): QString path; | - |
| 214 | switch (type) { | - |
| 215 | case DesktopLocation: | - |
| 216 | path = QDir::homePath() + QLatin1String("/Desktop"); executed (the execution status of this line is deduced): path = QDir::homePath() + QLatin1String("/Desktop"); | - |
| 217 | break; executed: break;Execution Count:2 | 2 |
| 218 | case DocumentsLocation: | - |
| 219 | path = QDir::homePath() + QLatin1String("/Documents"); executed (the execution status of this line is deduced): path = QDir::homePath() + QLatin1String("/Documents"); | - |
| 220 | break; executed: break;Execution Count:2 | 2 |
| 221 | case PicturesLocation: | - |
| 222 | path = QDir::homePath() + QLatin1String("/Pictures"); executed (the execution status of this line is deduced): path = QDir::homePath() + QLatin1String("/Pictures"); | - |
| 223 | break; executed: break;Execution Count:2 | 2 |
| 224 | | - |
| 225 | case FontsLocation: | - |
| 226 | path = QDir::homePath() + QLatin1String("/.fonts"); executed (the execution status of this line is deduced): path = QDir::homePath() + QLatin1String("/.fonts"); | - |
| 227 | break; executed: break;Execution Count:2 | 2 |
| 228 | | - |
| 229 | case MusicLocation: | - |
| 230 | path = QDir::homePath() + QLatin1String("/Music"); executed (the execution status of this line is deduced): path = QDir::homePath() + QLatin1String("/Music"); | - |
| 231 | break; executed: break;Execution Count:2 | 2 |
| 232 | | - |
| 233 | case MoviesLocation: | - |
| 234 | path = QDir::homePath() + QLatin1String("/Videos"); executed (the execution status of this line is deduced): path = QDir::homePath() + QLatin1String("/Videos"); | - |
| 235 | break; executed: break;Execution Count:2 | 2 |
| 236 | case DownloadLocation: | - |
| 237 | path = QDir::homePath() + QLatin1String("/Downloads"); executed (the execution status of this line is deduced): path = QDir::homePath() + QLatin1String("/Downloads"); | - |
| 238 | break; executed: break;Execution Count:2 | 2 |
| 239 | case ApplicationsLocation: | - |
| 240 | path = writableLocation(GenericDataLocation) + QLatin1String("/applications"); executed (the execution status of this line is deduced): path = writableLocation(GenericDataLocation) + QLatin1String("/applications"); | - |
| 241 | break; executed: break;Execution Count:3 | 3 |
| 242 | | - |
| 243 | default: | - |
| 244 | break; | 0 |
| 245 | } | - |
| 246 | | - |
| 247 | return path; executed: return path;Execution Count:17 | 17 |
| 248 | } | - |
| 249 | | - |
| 250 | static QStringList xdgDataDirs() | - |
| 251 | { | - |
| 252 | QStringList dirs; executed (the execution status of this line is deduced): QStringList dirs; | - |
| 253 | // http://standards.freedesktop.org/basedir-spec/latest/ | - |
| 254 | QString xdgDataDirsEnv = QFile::decodeName(qgetenv("XDG_DATA_DIRS")); executed (the execution status of this line is deduced): QString xdgDataDirsEnv = QFile::decodeName(qgetenv("XDG_DATA_DIRS")); | - |
| 255 | if (xdgDataDirsEnv.isEmpty()) { evaluated: xdgDataDirsEnv.isEmpty()| yes Evaluation Count:2 | yes Evaluation Count:62 |
| 2-62 |
| 256 | dirs.append(QString::fromLatin1("/usr/local/share")); executed (the execution status of this line is deduced): dirs.append(QString::fromLatin1("/usr/local/share")); | - |
| 257 | dirs.append(QString::fromLatin1("/usr/share")); executed (the execution status of this line is deduced): dirs.append(QString::fromLatin1("/usr/share")); | - |
| 258 | } else { executed: }Execution Count:2 | 2 |
| 259 | dirs = xdgDataDirsEnv.split(QLatin1Char(':')); executed (the execution status of this line is deduced): dirs = xdgDataDirsEnv.split(QLatin1Char(':')); | - |
| 260 | } executed: }Execution Count:62 | 62 |
| 261 | return dirs; executed: return dirs;Execution Count:64 | 64 |
| 262 | } | - |
| 263 | | - |
| 264 | QStringList QStandardPaths::standardLocations(StandardLocation type) | - |
| 265 | { | - |
| 266 | QStringList dirs; executed (the execution status of this line is deduced): QStringList dirs; | - |
| 267 | switch (type) { | - |
| 268 | case ConfigLocation: | - |
| 269 | { | - |
| 270 | // http://standards.freedesktop.org/basedir-spec/latest/ | - |
| 271 | const QString xdgConfigDirs = QFile::decodeName(qgetenv("XDG_CONFIG_DIRS")); executed (the execution status of this line is deduced): const QString xdgConfigDirs = QFile::decodeName(qgetenv("XDG_CONFIG_DIRS")); | - |
| 272 | if (xdgConfigDirs.isEmpty()) evaluated: xdgConfigDirs.isEmpty()| yes Evaluation Count:1 | yes Evaluation Count:6 |
| 1-6 |
| 273 | dirs.append(QString::fromLatin1("/etc/xdg")); executed: dirs.append(QString::fromLatin1("/etc/xdg"));Execution Count:1 | 1 |
| 274 | else | - |
| 275 | dirs = xdgConfigDirs.split(QLatin1Char(':')); executed: dirs = xdgConfigDirs.split(QLatin1Char(':'));Execution Count:6 | 6 |
| 276 | } | - |
| 277 | break; executed: break;Execution Count:7 | 7 |
| 278 | case GenericDataLocation: | - |
| 279 | dirs = xdgDataDirs(); executed (the execution status of this line is deduced): dirs = xdgDataDirs(); | - |
| 280 | break; executed: break;Execution Count:62 | 62 |
| 281 | case ApplicationsLocation: | - |
| 282 | dirs = xdgDataDirs(); executed (the execution status of this line is deduced): dirs = xdgDataDirs(); | - |
| 283 | for (int i = 0; i < dirs.count(); ++i) evaluated: i < dirs.count()| yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
| 284 | dirs[i].append(QLatin1String("/applications")); executed: dirs[i].append(QLatin1String("/applications"));Execution Count:1 | 1 |
| 285 | break; executed: break;Execution Count:1 | 1 |
| 286 | case DataLocation: | - |
| 287 | dirs = xdgDataDirs(); executed (the execution status of this line is deduced): dirs = xdgDataDirs(); | - |
| 288 | for (int i = 0; i < dirs.count(); ++i) evaluated: i < dirs.count()| yes Evaluation Count:2 | yes Evaluation Count:1 |
| 1-2 |
| 289 | appendOrganizationAndApp(dirs[i]); executed: appendOrganizationAndApp(dirs[i]);Execution Count:2 | 2 |
| 290 | break; executed: break;Execution Count:1 | 1 |
| 291 | default: | - |
| 292 | break; executed: break;Execution Count:1 | 1 |
| 293 | } | - |
| 294 | const QString localDir = writableLocation(type); executed (the execution status of this line is deduced): const QString localDir = writableLocation(type); | - |
| 295 | dirs.prepend(localDir); executed (the execution status of this line is deduced): dirs.prepend(localDir); | - |
| 296 | return dirs; executed: return dirs;Execution Count:72 | 72 |
| 297 | } | - |
| 298 | | - |
| 299 | QT_END_NAMESPACE | - |
| 300 | | - |
| 301 | #endif // QT_NO_STANDARDPATHS | - |
| 302 | | - |
| | |