protonscr

Steam cannot launch non-steam games with spaces in the path

steamclosed High priorityreviewed
ValveSoftware/steam-for-linux#711 · opened 2013-01-15 by arrowmaster · updated 2013-01-31 · 16 comments · github
Aarrowmaster 2013-01-15 github

I tried to add a non-steam game to steam and it did not come with a .desktop file so I created one. The game extracts to a directory with a space in the name and is executed by a .sh script that also has a space in the name. First I tried putting the full path in the Exec= line in the .desktop file and escaping the spaces with \ and it would not run in steam even though it would run from my DE menu. Second I tried putting the full path in quotes and steam wouldn't even add the game anymore.

I finally created a simple script to exec full\ path and had the .desktop file run that script and steam finally launched the game without issue.

When I checked the output of steam while doing all this I was getting this error message when it was failing to launch the game.

/bin/sh: 1: Syntax error: Unterminated quoted string
Bbdeen-valve maintainer 2013-01-16 github

Can you attach your .desktop file so that I can more fully see what you're describing above?

Bbdeen-valve maintainer 2013-01-16 github

...ahh...never mind. I finally got a repro.

Aarrowmaster 2013-01-16 github

I'm in no way an expert on .desktop files and was doing this from some trial and error because the game did not come with a .desktop file. This is what worked from my DEs menu but not from steam.

[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=Katawa Shoujo
Exec=/home/arrow/Katawa\ Shoujo-linux-x86/katawa\ shoujo.sh
Terminal=false
Categories=Game;

Changing the Exec line to this failed to let it even be added as a game in steam. I suspect this isn't even valid normally but I had to try the common ways of dealing with spaces.

Exec="/home/arrow/Katawa Shoujo-linux-x86/katawa shoujo.sh"

I finally created a simple script named katawa-shoujo.sh and put it in my path.

#!/bin/sh
exec /home/arrow/Katawa\ Shoujo-linux-x86/katawa\ shoujo.sh

And changed the Exec line to this and it works in steam.

Exec=katawa-shoujo.sh
Bbdeen-valve maintainer 2013-01-16 github

You can simply choose the .sh file rather than pick the .desktop. When you go to add the non-steam game, just change the file picking dialog to look for all files, and then choose your .sh file.
It should work.
I'll still see what I can do about fixing the .desktop handling here in this case.

Aarrowmaster 2013-01-16 github

The file picking dialog only allows me to pick .desktop files. I cannot change it to look for anything except Applications.

Bbdeen-valve maintainer 2013-01-16 github

Your file picker doesn't look something like this? You should be able to drop down the File Type control and choose "All Files".

Selection_008

Does yours not do that?

What desktop manager/Linux Distro are you running?

Aarrowmaster 2013-01-16 github

I have that exact same file picker except there is no All Files in the dropdown. The only option is Applications.

Debian Wheezy 64bit with Cinnamon DE from Debian Sid.

Bbdeen-valve maintainer 2013-01-16 github

Ok, got the missing All Files in the dropdown to repro. Not sure why there's a difference yet...

Ggdrewb-valve maintainer 2013-01-17 github

The change to add the All Files option is recent and hasn't made it outside of Valve yet.

Bbdeen-valve maintainer 2013-01-17 github

Ok, I have a fix for this. The shell expects spaces to be quoted with a ''. We'll accept that format in the .desktop files.
Need to test a bit more, before I check in.

Bbdeen-valve maintainer 2013-01-18 github

Ok, fixed. Should be in the next release..

Aarrowmaster 2013-01-23 github

Steam does not like the .desktop files created by CrossOver either. They use double quotes around the Exec entry but also have a shebang letting them be executed like scripts with xdg-open.

#!/usr/bin/env xdg-open

[Desktop Entry]
Encoding=UTF-8
Type=Application
X-Created-By=cxoffice-d55ec27d-90bc-4943-b430-527902170deb
Categories=X-cxmenu-cxoffice-d55ec27d-90bc-4943-b430-527902170deb-19b15q9;
Icon=cxmenu-cxoffice-d55ec27d-90bc-4943-b430-527902170deb-493F_Grim Fandango Launcher.0
Exec="/home/arrow/.cxoffice/Grim Fandango/desktopdata/cxmenu/StartMenu.C^5E3A^5Fusers^5FPublic^5FStart^2BMenu/Programs/Grim+Fandango/Grim+Fandango.lnk"
Name=Grim Fandango
Comment=Run Grim Fandango

And the .lnk file it is pointing too is actually a shell script. Which could be used to get around this problem, but the .desktop file has the icons and such in it.

Jjleclanche 2013-01-23 github

FWIW we had the exact same issue in Razor:

https://github.com/Razor-qt/razor-qt/issues/510

Aarrowmaster 2013-01-23 github

In addition I seem to have lost some of the previous functionality of the "Add-non steam game" dialog. After the update that added the All Files option, when using the browse files dialog the selected game is not selected when its added to the previous list. Resulting in having to find it in the list and manually select it. Previously it was selected automatically.

Aarrowmaster 2013-01-24 github

Steam still doesn't work with .desktop files created by CrossOver since the latest update. Issue is not completely resolved, please reopen.

Bbdeen-valve maintainer 2013-01-28 github

Ok, revamped my original fix. Tested with CrossOver links. Please let us know if you have problems with it.

Nothing extracted yet.