Quote and escape desktop entry executable path (#917)

This commit is contained in:
capitalistspz 2023-08-03 12:54:16 +00:00 committed by GitHub
parent 34ff9da097
commit 7111cbb103
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 = const auto desktop_entry_string =
fmt::format("[Desktop Entry]\n" fmt::format("[Desktop Entry]\n"
"Name={}\n" "Name={0}\n"
"Comment=Play {} on Cemu\n" "Comment=Play {0} on Cemu\n"
"Exec={} --title-id {:016x}\n" "Exec={1:?} --title-id {2:016x}\n"
"Icon={}\n" "Icon={3}\n"
"Terminal=false\n" "Terminal=false\n"
"Type=Application\n" "Type=Application\n"
"Categories=Game;", "Categories=Game;",
title_name, title_name,
title_name,
_pathToUtf8(exe_path), _pathToUtf8(exe_path),
title_id, title_id,
_pathToUtf8(icon_path.value_or(""))); _pathToUtf8(icon_path.value_or("")));