StratusFearMe21/cargo-appimage

Why set the exec parent directory as current directory?

Closed this issue · 5 comments

I need to access the current/working directory, but the apprun set the current directory as the executable parent directory.

Yes. This is because theoretically, you would want to bundle assets and other things into the AppImage binary. To get the current path of the .AppImage file, you can use the APPIMAGE environment variable https://docs.appimage.org/packaging-guide/environment-variables.html

Sorry for slow response time btw

Well, I was already using this environment variable, but I can't accept the fact that I need to do this to make it work, pretty frustrating.

I'm sorry that cargo-appimage doesn't match your use case, but what you have encountered is one of the limitations of the AppImage standard. When deciding which directory the AppRun should cd into, it has 2 options

  • If you cd into the directory of the AppRun itself, your app would be able to access everything bundled into the AppImage without using any environment variables. However, in order to access the directory of the AppImage itself, you need to use the APPIMAGE environment variable
  • If you cd into the directory of the AppImage, your app can access its own directory without using any environment variables. However, in order to access any data bundled within the AppImage, you need to use the APPDIR environment variable.

Because the first use case is more common, that's what I choose to support.

appimage is an interesting concept, but this way of working doesn't seem pleasant for any use case, while I hope people start building packages for specific distributions I use appimage for those who want to use it without building, flatpak and snap are horrible so appimage does its job well.

Well I'll close and continue using as I am, but I hope that in the future GNU/Linux will have a consensus on how to manage packages other than creating another 'universal package manager'