Open bentley opened 4 years ago
GBE+ is indeed designed with the expectation that the user who is doing the building is also the user doing the installation. However, if another setup is necessary, e.g. where GBE+'s data directory needs to be accessible from a system-wide location, the existing "portable mode" should be the choice of installation. On Unix-like systems, this means keeping the binary + data folder together in any location except the user's home folder.
If GBE+ cannot detect the gbe.ini
in the home directory, it looks to the current working directory for data, config, and everything else. An install path to somewhere like /opt/gbe_plus
would work as an example. Practically any system-wide accessible location would do. Something like this would be my preferred solution:
elseif(UNIX AND NOT APPLE)
if(PORTABLE_INSTALL)
install(TARGETS gbe_plus DESTINATION ${CUSTOM_DIR})
install(FILES gbe.ini DESTINATION ${CUSTOM_DIR})
install(DIRECTORY data DESTINATION ${CUSTOM_DIR})
install(CODE "execute_process(COMMAND chown -R whatever permissions ${CUSTOM_DIR})")
endif()
else()
install(TARGETS gbe_plus DESTINATION /usr/local/bin)
install(FILES gbe.ini DESTINATION ${USER_HOME}/.gbe_plus/)
install(DIRECTORY data DESTINATION ${USER_HOME}/.gbe_plus/)
install(CODE "execute_process(COMMAND chown -R ${USER}:${USER} ${USER_HOME}/.gbe_plus)")
endif()
endif()
Obviously, in this case, the directory should be specified at build time, that's perfectly fine.
On Unix-like systems, this means keeping the binary + data folder together in any location except the user's home folder.
It’s unusual for executables to be installed to data directories, especially by packages, because such directories are not in PATH
.
If the data directory is specified at build time, the emulator should be able to handle being run from a different directory such as /usr/bin
by looking for data files in that compiled‐in directory.
In a package management situation, the build user is different from the user eventually running the emulator, and this is unusable.
The ideal situation would be:
/usr/local/share/gbe_plus
(I’m assuming the files can be read‐only)gbe.ini
in/etc
if none is found in the home directory