Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quote and escape desktop entry executable path #917

Merged
merged 3 commits into from
Aug 3, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions src/gui/components/wxGameList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
#include <boost/algorithm/string.hpp>
#include <boost/tokenizer.hpp>

#include <fmt/std.h>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This include shouldn't be necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right


#include "config/ActiveSettings.h"
#include "config/LaunchSettings.h"
#include "Cafe/TitleList/GameInfo.h"
Expand Down Expand Up @@ -1287,17 +1289,18 @@ void wxGameList::CreateShortcut(GameInfo2& gameInfo) {
}
}
}
// 'Icon' accepts spaces in file name, does not accept quoted file paths
// 'Exec' does not accept non-escaped spaces, and can accept quoted file paths
const auto desktop_entry_string =
fmt::format("[Desktop Entry]\n"
"Name={}\n"
"Comment=Play {} on Cemu\n"
"Exec={} --title-id {:016x}\n"
"Icon={}\n"
"Name={0}\n"
"Comment=Play {0} on Cemu\n"
"Exec={1:?} --title-id {2:016x}\n"
"Icon={3}\n"
"Terminal=false\n"
"Type=Application\n"
"Categories=Game;",
title_name,
title_name,
_pathToUtf8(exe_path),
title_id,
_pathToUtf8(icon_path.value_or("")));
Expand Down Expand Up @@ -1339,4 +1342,4 @@ void wxGameList::CreateShortcut(GameInfo2& gameInfo) {
}
#endif
}
#endif
#endif