mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-22 06:05:38 +00:00
(Unix) Updated the .desktop file parser to handle some non-standard shortcut files.
This commit is contained in:
parent
bfc29380c5
commit
077c6abf3e
|
@ -1448,6 +1448,13 @@ void FileData::launchGame()
|
||||||
std::ifstream desktopFileStream;
|
std::ifstream desktopFileStream;
|
||||||
desktopFileStream.open(Utils::String::replace(romPath, "\\", ""));
|
desktopFileStream.open(Utils::String::replace(romPath, "\\", ""));
|
||||||
for (std::string line; getline(desktopFileStream, line);) {
|
for (std::string line; getline(desktopFileStream, line);) {
|
||||||
|
// Some non-standard .desktop files add a leading line such as
|
||||||
|
// "#!/usr/bin/env xdg-open" and some lines may also be indented by
|
||||||
|
// whitespace characters. So we need to handle such oddities in order
|
||||||
|
// to parse and run these files.
|
||||||
|
line = Utils::String::trim(line);
|
||||||
|
if (line.substr(0, 2) == "#!")
|
||||||
|
continue;
|
||||||
if (line.find("[Desktop Entry]") != std::string::npos)
|
if (line.find("[Desktop Entry]") != std::string::npos)
|
||||||
validFile = true;
|
validFile = true;
|
||||||
if (line.substr(0, 5) == "Exec=") {
|
if (line.substr(0, 5) == "Exec=") {
|
||||||
|
|
Loading…
Reference in a new issue