Skip to content

Commit

Permalink
Quote and escape desktop entry executable path (#917)
Browse files Browse the repository at this point in the history
  • Loading branch information
capitalistspz authored Aug 3, 2023
1 parent 34ff9da commit 7111cbb
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/gui/components/wxGameList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1287,17 +1287,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 +1340,4 @@ void wxGameList::CreateShortcut(GameInfo2& gameInfo) {
}
#endif
}
#endif
#endif

0 comments on commit 7111cbb

Please sign in to comment.