mirror of
https://github.com/QuasarApp/installer-framework.git
synced 2025-04-27 22:14:32 +00:00
Write desktop entry and items to the correct folders
Data should not be written to directories in XDG_DATA_DIRS. The spec state that files should only be writen to the directory in XDG_DATA_HOME. Change-Id: I755963fa2f70d03c77d7beec0e3f87accde925d0 Fixes: QTIFW-1269 Reviewed-by: Nikos Chantziaras <realnc@gmail.com> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Katja Marttila <katja.marttila@qt.io>
This commit is contained in:
parent
2a791f276d
commit
d6768e5a16
@ -133,9 +133,8 @@
|
||||
|
||||
If \c filename is absolute, the desktop entry is stored there.
|
||||
Otherwise, it is stored in the location specified in
|
||||
\c{$XDG_DATA_DIRS/applications} or
|
||||
\c{$XDG_DATA_HOME/applications}, including the default paths for
|
||||
both, as defined by freedesktop.org.
|
||||
\c{$XDG_DATA_HOME/applications}, including the default path,
|
||||
as defined by freedesktop.org.
|
||||
|
||||
The key-value pairs are written to the file.
|
||||
|
||||
@ -145,8 +144,8 @@
|
||||
\li "InstallIcons" \c directory \c [Vendorprefix]
|
||||
\li Installs the contents of \c directory into a location, as
|
||||
specified by freedesktop.org. That is, into
|
||||
\c {$XDG_DATA_DIRS/icons}, \c {/usr/share/icons}, or
|
||||
\c {$HOME/.icons}. The files are removed from their initial
|
||||
\c {$XDG_DATA_HOME/icons} or
|
||||
\c {$HOME/.local/share/icons}. The files are removed from their initial
|
||||
location. Make sure to add this operation after the operation
|
||||
that extracts the files from the archive.
|
||||
If you provide a \c Vendorprefix it replaces all characters up to the
|
||||
|
@ -49,17 +49,13 @@ QString CreateDesktopEntryOperation::absoluteFileName()
|
||||
if (hasValue(QLatin1String("directory")))
|
||||
return QDir(value(QLatin1String("directory")).toString()).absoluteFilePath(filename);
|
||||
|
||||
QStringList XDG_DATA_DIRS = QString::fromLocal8Bit(qgetenv("XDG_DATA_DIRS"))
|
||||
.split(QLatin1Char(':'),
|
||||
QString::SkipEmptyParts);
|
||||
QStringList XDG_DATA_HOME = QString::fromLocal8Bit(qgetenv("XDG_DATA_HOME"))
|
||||
.split(QLatin1Char(':'),
|
||||
QString::SkipEmptyParts);
|
||||
|
||||
XDG_DATA_DIRS.push_back(QLatin1String("/usr/share")); // default path
|
||||
XDG_DATA_HOME.push_back(QDir::home().absoluteFilePath(QLatin1String(".local/share"))); // default path
|
||||
|
||||
const QStringList directories = XDG_DATA_DIRS + XDG_DATA_HOME;
|
||||
const QStringList directories = XDG_DATA_HOME;
|
||||
QString directory;
|
||||
for (QStringList::const_iterator it = directories.begin(); it != directories.end(); ++it) {
|
||||
if (it->isEmpty())
|
||||
|
@ -42,20 +42,18 @@ QString InstallIconsOperation::targetDirectory()
|
||||
if (hasValue(QLatin1String("targetdirectory")))
|
||||
return value(QLatin1String("targetdirectory")).toString();
|
||||
|
||||
QStringList XDG_DATA_DIRS = QString::fromLocal8Bit(qgetenv("XDG_DATA_DIRS"))
|
||||
QStringList XDG_DATA_HOME = QString::fromLocal8Bit(qgetenv("XDG_DATA_HOME"))
|
||||
.split(QLatin1Char(':'),
|
||||
QString::SkipEmptyParts);
|
||||
XDG_DATA_DIRS.push_back(QLatin1String("/usr/share/pixmaps")); // default path
|
||||
XDG_DATA_DIRS.push_back(QDir::home().absoluteFilePath(QLatin1String(".local/share/icons"))); // default path
|
||||
XDG_DATA_DIRS.push_back(QDir::home().absoluteFilePath(QLatin1String(".icons"))); // default path
|
||||
XDG_DATA_HOME.push_back(QDir::home().absoluteFilePath(QLatin1String(".local/share/icons"))); // default path
|
||||
|
||||
QString directory;
|
||||
const QStringList& directories = XDG_DATA_DIRS;
|
||||
const QStringList& directories = XDG_DATA_HOME;
|
||||
for (QStringList::const_iterator it = directories.begin(); it != directories.end(); ++it) {
|
||||
if (it->isEmpty())
|
||||
continue;
|
||||
|
||||
// our default dirs are correct, XDG_DATA_DIRS set via env need "icon" at the end
|
||||
// our default dirs are correct, XDG_DATA_HOME set via env needs "icon" at the end
|
||||
if ((it + 1 == directories.end()) || (it + 2 == directories.end()) || (it + 3 == directories.end()))
|
||||
directory = QDir(*it).absolutePath();
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user