Closed boombatower closed 9 years ago
Expanding ~
the is shell's job. It's not expanded because in your invocation it's in the middle of the string.
You can instead use openage --data "~/.openage/assets"
, or openage --data="$HOME/.openage/assets"
.
That's what I thought, but didn't seem to be working the way I expected. As makes sense now it appears the =
sign messes things up since it can then parse the individual parts. So for example the following works:
openage --data ~/.openage/assets
The reason I added the quotes was the desktop file validator complained without them.
Assuming it doesn't like the above I think
"$HOME/.openage/assets"
with or without the equal sign is probably the best bet.
The error I get if I do with or without equal, but with ~ outside of quotes is:
$ desktop-file-validate dist/openage.desktop
dist/openage.desktop: error: value "openage --data ~/.openage/assets %u" for key "Exec" in group "Desktop Entry" contains a reserved character '~' outside of a quote
Hmm, doesn't like $HOME either. and escape it obviously interprets as literal $
.
$ desktop-file-validate dist/openage.desktop
dist/openage.desktop: error: value "openage --data="$HOME/.openage/assets" %u" for key "Exec" in group "Desktop Entry" contains a non-escaped character '$' in a quote, but it should be escaped with two backslashes ("\\$")
Even more fun with single quotes.
$ desktop-file-validate dist/openage.desktop
dist/openage.desktop: error: value "openage --data='$HOME/.openage/assets' %u" for key "Exec" in group "Desktop Entry" contains a reserved character ''' outside of a quote
dist/openage.desktop: error: value "openage --data='$HOME/.openage/assets' %u" for key "Exec" in group "Desktop Entry" contains a reserved character '$' outside of a quote
dist/openage.desktop: error: value "openage --data='$HOME/.openage/assets' %u" for key "Exec" in group "Desktop Entry" contains a reserved character ''' outside of a quote
I guess that's why you see loads of applications shipping with a core shell script. Then we could do something like...
Exec=openage.sh
Where openage.sh
contains:
openage --data ~/.openage/assets
That or the asset manager should just be told a mode and it figures out where to look?
The validator seems to also add
#!/usr/bin/env xdg-open
Which I've seen before and seems to match official spec, yet most projects and ones on my system don't have it.
Ok, I figured out semi clever solution. Setting path, which will expand as expected. Obviously a load of different way to do this, but this seems sensible...and best of all it actually works (assuming you setup data, which I have symbolically link to dev clone).
[Desktop Entry]
Exec=openage --data=assets %u
Path=~/.openage/
Everyone good with that? Also means any config will be in working directory.
Meh, except it prints a warning...not an error though!?
$ desktop-file-validate dist/openage.desktop
dist/openage.desktop: warning: value "~/.openage/" for key "Path" in group "Desktop Entry" does not look like an absolute path
Seems that openage will not load without a terminal available? One has to add
Terminal=true
for .desktop file to work
Spawned #106.
I use $HOME/.openage/assets
as my data folder and it works without any problem. As mic-e said, it is shell's work.
Past that, read the comment. Issues are specific to .desktop files.
This is the shell's job, why do these damn freedesktop files ignore homedirs? Maybe they have some special replacement format chars, using args and homedirs seems to be a common usecase..
http://stackoverflow.com/a/2552458
*nix: getenv("HOME")
Windows: getenv("HOMEDRIVE") ++ getenv("HOMEPATH")
Kay, good idea. For the per-user
dir that seems to be the way to go.
I suggest to convert assets into that folder already. It doesn't make any sense that the folder created for the assets is not the program is using by default. Another way to go would be let the user input a path and then the converter writes down a config file ready to be read from openage, containing the path.
Yes, i'll try to invoke the conversion from the game binary as soon as possible (#29), the destination folder will be updated then.
The problem is the quotation. If you write --data=~/lol/folder/
it works, your shell just does not expand it in the quotation mark.
yah didn't read my comments....we can close this.
As per #81, the
.desktop
file would like to use the following commandIt appears that openage does not expand that and looks for literally
~/.openage/assets
. Would be great to see it expand the argument.