oskardolch / SteamCAD

2D CAD especially designed to draw steam locomotives
GNU General Public License v3.0
194 stars 14 forks source link

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

Open ghost opened 4 years ago

ghost commented 4 years ago

Actual behavior

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

Expected behavior

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

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

oskardolch commented 4 years ago

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?

ghost commented 4 years ago

Hey, @probonopd, can you help?

probonopd commented 4 years ago

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.

oskardolch commented 4 years ago

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.

probonopd commented 4 years ago

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.,:

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