SteamCAD icon indicating copy to clipboard operation
SteamCAD copied to clipboard

AppImage: Create DUnits.ini and DPapers.ini on first launch

Open ghost opened this issue 4 years ago • 5 comments

  • OS: Linux (MX-Linux 19.1 / Debian 10 buster)
  • Version: SteamCAD-205aa29-x86_64.AppImage

Actual behavior

If launch SteamCAD-*.AppImage for the first time ("clean install") it creates local folder with only one configuration file:

  • /user/<username>/.SteamCAD/ (aka ~/.SteamCAD/)
    • ../config.xml

Expected behavior

SteamCAD-*.AppImage on the first launch should also add two INI-files into this folder:

  • /home/<username>/.SteamCAD/ (aka ~/.SteamCAD/)
    • ../config.xml
    • ../DPapers.ini
    • ../DUnits.ini

NOTE: If such files already exists — SteamCAD-*.AppImage should NOT overwrite it! (at least until it changed by user in SteamCAD's preferences menu)

ghost avatar Apr 06 '20 13:04 ghost

The standard GNU build system should deliver those files upon "sudo make install". I am not very familiar with the AppImage system, my understanding was that if the GNU build system works correctly, then AppImage should be OK. Can you investigate it more to decide whether it is a GNU build system problem or the AppImage problem?

oskardolch avatar Apr 08 '20 20:04 oskardolch

Hey, @probonopd, can you help?

ghost avatar Apr 09 '20 08:04 ghost

make install should never install anything to $HOME of the user, as this would also not work for Linux distributions. For example, Debian packages will NEVER install anything into $HOME. Similarly, the stuff that is inside the AppImage will not magically appear in $HOME.

The application needs to write those files when the application is being launched, if they don't already exist.

probonopd avatar Apr 15 '20 16:04 probonopd

Hi, again, sorry for the delay. I've checked the logic, and the make install does not copy anything into the $HOME folder. It copies the ini files into a common folder instead (I am not sure about the location, it is controlled by the GNU build system). The application then searches the files in the $HOME folder, and if they don't exist, it would copy them from the common location. Recently I've tried classic installation on a fresh Debian system, which means configure, make, sudo make install and it seems to work fine. So if something was broken in the AppImage build, I don't know. I am really quite unfamiliar with this staff.

oskardolch avatar Apr 21 '20 19:04 oskardolch

The application then searches the files in the $HOME folder, and if they don't exist, it would copy them from the common location.

This is probably using an absolute path for the "common location" which is not going to work for the AppImage, because AppImages are relocatable in the filesystem. By constructing a path to the "common location" that takes into consideration that the "common location" can move around in the filesystem, this can be fixed.

E.g.,:

  • If the application is at /usr/bin/steamcad, then the common location could be /usr/share/steamcad.
  • If the application is at /somewhere/else/bin/steamcad, then the common location could be /somewhere/else/bin/steamcad.

Please see https://docs.appimage.org/reference/best-practices.html#binaries-must-not-use-compiled-in-absolute-paths for more information.

probonopd avatar Apr 23 '20 17:04 probonopd