mirror of
https://github.com/the-sane/lug-helper.git
synced 2024-12-28 16:14:21 +00:00
Fix .desktop quoting and escaping
After MUCH trial and error because this is not documented properly, the exec line needs to be quoted and spaces in the path line needs to be escaped but NOT quoted! phew!
This commit is contained in:
parent
9361fa3305
commit
89abb7fbe4
@ -2479,15 +2479,18 @@ install_game_wine() {
|
|||||||
installed_launch_script="$install_dir/$(basename "$launch_script")"
|
installed_launch_script="$install_dir/$(basename "$launch_script")"
|
||||||
|
|
||||||
# Update WINEPREFIX in game launch script
|
# Update WINEPREFIX in game launch script
|
||||||
sed -i "s|^export WINEPREFIX.*|export WINEPREFIX=$install_dir|" "$install_dir/$(basename "$launch_script")"
|
sed -i "s|^export WINEPREFIX.*|export WINEPREFIX=\"$install_dir\"|" "$install_dir/$(basename "$launch_script")"
|
||||||
|
|
||||||
# Modify the .desktop files installed by wine to exec the game launch script
|
# Modify the .desktop files installed by wine to exec the game launch script
|
||||||
debug_print continue "Updating .desktop files..."
|
debug_print continue "Updating .desktop files..."
|
||||||
if [ -f "${XDG_DESKTOP_DIR:-$HOME/Desktop}/RSI Launcher.desktop" ]; then
|
if [ -f "${XDG_DESKTOP_DIR:-$HOME/Desktop}/RSI Launcher.desktop" ]; then
|
||||||
# Replace the exec line with our launch script
|
# Replace the exec line with our launch script
|
||||||
sed -i "s|^Exec=env.*|Exec=$installed_launch_script|" "${XDG_DESKTOP_DIR:-$HOME/Desktop}/RSI Launcher.desktop"
|
sed -i "s|^Exec=env.*|Exec=$installed_launch_script|" "${XDG_DESKTOP_DIR:-$HOME/Desktop}/RSI Launcher.desktop"
|
||||||
# Escape spaces in the exec and path lines
|
# Quote exec line
|
||||||
sed -i '/^Exec=\|^Path=/s/ /\\\s/g' "${XDG_DESKTOP_DIR:-$HOME/Desktop}/RSI Launcher.desktop"
|
sed -i '/^Exec=/s/=/="/' "${XDG_DESKTOP_DIR:-$HOME/Desktop}/RSI Launcher.desktop"
|
||||||
|
sed -i '/^Exec=/s/$/"/' "${XDG_DESKTOP_DIR:-$HOME/Desktop}/RSI Launcher.desktop"
|
||||||
|
# Escape spaces in path line
|
||||||
|
sed -i '/^Path=/s/ /\\\s/g' "${XDG_DESKTOP_DIR:-$HOME/Desktop}/RSI Launcher.desktop"
|
||||||
# Make it start in a terminal
|
# Make it start in a terminal
|
||||||
echo "Terminal=true" >> "${XDG_DESKTOP_DIR:-$HOME/Desktop}/RSI Launcher.desktop"
|
echo "Terminal=true" >> "${XDG_DESKTOP_DIR:-$HOME/Desktop}/RSI Launcher.desktop"
|
||||||
debug_print continue "Updated ${XDG_DESKTOP_DIR:-$HOME/Desktop}/RSI Launcher.desktop"
|
debug_print continue "Updated ${XDG_DESKTOP_DIR:-$HOME/Desktop}/RSI Launcher.desktop"
|
||||||
@ -2495,8 +2498,11 @@ install_game_wine() {
|
|||||||
if [ -f "$data_dir/applications/wine/Programs/Roberts Space Industries/RSI Launcher.desktop" ]; then
|
if [ -f "$data_dir/applications/wine/Programs/Roberts Space Industries/RSI Launcher.desktop" ]; then
|
||||||
# Replace the exec line with our launch script
|
# Replace the exec line with our launch script
|
||||||
sed -i "s|^Exec=env.*|Exec=$installed_launch_script|" "$data_dir/applications/wine/Programs/Roberts Space Industries/RSI Launcher.desktop"
|
sed -i "s|^Exec=env.*|Exec=$installed_launch_script|" "$data_dir/applications/wine/Programs/Roberts Space Industries/RSI Launcher.desktop"
|
||||||
# Escape spaces in the exec and path lines
|
# Quote exec line
|
||||||
sed -i '/^Exec=\|^Path=/s/ /\\\s/g' "$data_dir/applications/wine/Programs/Roberts Space Industries/RSI Launcher.desktop"
|
sed -i '/^Exec=/s/=/="/' "$data_dir/applications/wine/Programs/Roberts Space Industries/RSI Launcher.desktop"
|
||||||
|
sed -i '/^Exec=/s/$/"/' "$data_dir/applications/wine/Programs/Roberts Space Industries/RSI Launcher.desktop"
|
||||||
|
# Escape spaces in path line
|
||||||
|
sed -i '/^Path=/s/ /\\\s/g' "$data_dir/applications/wine/Programs/Roberts Space Industries/RSI Launcher.desktop"
|
||||||
# Make it start in a terminal
|
# Make it start in a terminal
|
||||||
echo "Terminal=true" >> "$data_dir/applications/wine/Programs/Roberts Space Industries/RSI Launcher.desktop"
|
echo "Terminal=true" >> "$data_dir/applications/wine/Programs/Roberts Space Industries/RSI Launcher.desktop"
|
||||||
debug_print continue "Updated $data_dir/applications/wine/Programs/Roberts Space Industries/RSI Launcher.desktop"
|
debug_print continue "Updated $data_dir/applications/wine/Programs/Roberts Space Industries/RSI Launcher.desktop"
|
||||||
|
Loading…
Reference in New Issue
Block a user