How to escape spaces in .desktop files Exec line
- by nh2
I want to make a .desktop file like described here.
[Desktop Entry]
Name=Sublime Text 2
GenericName=Sublime Text 2
Comment=Edit text files
Exec=/home/user/opt/sublime/Sublime Text 2/sublime_text %U
However, running that from Nautilus's context menu using Open with this gives me
Could not find '/home/user/opt/sublime/Sublime'
So I tried
Exec="/home/user/opt/sublime/Sublime Text 2/sublime_text" %U
and got
Text ended before matching quote was found for ". (The text was '"/home/user/opt/sublime/Sublime')
What is the correct way to escape spaces in the Exec line of .desktop files?