This repository has been archived by the owner on Dec 17, 2017. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix for #66 Autostart issues with spaces/env vars? (need review)
- Loading branch information
Showing
1 changed file
with
15 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -283,6 +283,14 @@ XdgDesktopFile::Type XdgDesktopFilePrivate::detectType() | |
|
||
if (typeStr == "Directory") | ||
return XdgDesktopFile::DirectoryType; | ||
|
||
// here we are trying to be a little bit tricky. | ||
// Like "guess what? I think it should be an app..." | ||
// For example: users expect running incomplete | ||
// desktop files as in: | ||
// https://github.com/Razor-qt/razor-qt/issues/66 | ||
if (!value("Exec").toString().isEmpty()) | ||
return XdgDesktopFile::ApplicationType; | ||
|
||
return XdgDesktopFile::UnknownType; | ||
} | ||
|
@@ -745,6 +753,13 @@ QStringList XdgDesktopFilePrivate::expandExecString(const QStringList& urls) con | |
{ | ||
continue; | ||
} | ||
|
||
// expand some environment varaibles because QProcess is not | ||
// BASH to expand it itself. | ||
if (token.contains('~')) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
pvanek
via email
Author
Member
|
||
token = token.replace("~", qgetenv("HOME")); | ||
if (token.contains('$')) | ||
token = token.replace(QRegExp("\\$HOME"), qgetenv("HOME")); | ||
|
||
// ---------------------------------------------------------- | ||
result << token; | ||
|
I'm not sure tilde expansion is done within .desktop files, as Bash is the one doing that. Did you check?
If it's done, this right here won't do. It will expand improper tildes, and it will not support tildes for other users (ie. ~user/foo)
As for env variables, you're only checking for home. You'll want to check for any variable in there.