Changeset View
Changeset View
Standalone View
Standalone View
src/lib/plugin/desktopfileparser.cpp
Show First 20 Lines • Show All 273 Lines • ▼ Show 20 Line(s) | 272 | #ifdef BUILDING_DESKTOPTOJSON_TOOL | |||
---|---|---|---|---|---|
274 | if (valueEscaped != valueRaw) { | 274 | if (valueEscaped != valueRaw) { | ||
275 | DESKTOPTOJSON_VERBOSE_DEBUG << "Line " << lineNr << " contained escape sequences"; | 275 | DESKTOPTOJSON_VERBOSE_DEBUG << "Line " << lineNr << " contained escape sequences"; | ||
276 | } | 276 | } | ||
277 | #endif | 277 | #endif | ||
278 | 278 | | |||
279 | return true; | 279 | return true; | ||
280 | } | 280 | } | ||
281 | 281 | | |||
282 | QVector<CustomPropertyDefinition>* parseServiceTypesFile(QString path) | 282 | static QVector<CustomPropertyDefinition>* parseServiceTypesFile(const QString &inputPath) | ||
283 | { | 283 | { | ||
284 | int lineNr = 0; | 284 | int lineNr = 0; | ||
285 | QString path = inputPath; | ||||
285 | if (QDir::isRelativePath(path)) { | 286 | if (QDir::isRelativePath(path)) { | ||
286 | const QString originalPath = path; | | |||
287 | path = QStandardPaths::locate(QStandardPaths::GenericDataLocation, | 287 | path = QStandardPaths::locate(QStandardPaths::GenericDataLocation, | ||
288 | QStringLiteral("kservicetypes5/") + path); | 288 | QStringLiteral("kservicetypes5/") + inputPath); | ||
289 | QString rcPath; | ||||
289 | if (path.isEmpty()) { | 290 | if (path.isEmpty()) { | ||
290 | qCWarning(DESKTOPPARSER).nospace() << "Could not locate service type file kservicetypes5/" << qPrintable(originalPath) << ", tried " << QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation); | 291 | rcPath = QStringLiteral(":/kservicetypes5/") + inputPath; | ||
292 | if (QFileInfo::exists(rcPath)) { | ||||
293 | path = rcPath; | ||||
294 | } | ||||
295 | } | ||||
296 | if (path.isEmpty()) { | ||||
297 | qCWarning(DESKTOPPARSER).nospace() << "Could not locate service type file kservicetypes5/" << qPrintable(inputPath) << ", tried " << QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation) << " and " << rcPath; | ||||
291 | return nullptr; | 298 | return nullptr; | ||
292 | } | 299 | } | ||
293 | } | 300 | } | ||
294 | QFile df(path); | 301 | QFile df(path); | ||
295 | if (!df.exists()) { | 302 | if (!df.exists()) { | ||
296 | qCCritical(DESKTOPPARSER) << "Service type file" << path << "does not exist"; | 303 | qCCritical(DESKTOPPARSER) << "Service type file" << path << "does not exist"; | ||
297 | return nullptr; | 304 | return nullptr; | ||
298 | } | 305 | } | ||
▲ Show 20 Lines • Show All 267 Lines • Show Last 20 Lines |