Skip to content
This repository has been archived by the owner on Dec 17, 2017. It is now read-only.

Commit

Permalink
fix for #66 Autostart issues with spaces/env vars? (need review)
Browse files Browse the repository at this point in the history
  • Loading branch information
pvanek committed Nov 28, 2011
1 parent edf28e8 commit fb135ba
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions librazorqt/qtxdg/xdgdesktopfile.cpp
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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.

Copy link
@jleclanche

jleclanche Nov 28, 2011

Member

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.

This comment has been minimized.

Copy link
@pvanek

pvanek via email Nov 28, 2011

Author Member
token = token.replace("~", qgetenv("HOME"));
if (token.contains('$'))
token = token.replace(QRegExp("\\$HOME"), qgetenv("HOME"));

// ----------------------------------------------------------
result << token;
Expand Down

0 comments on commit fb135ba

Please sign in to comment.