Open barracuda156 opened 5 months ago
@uowuo Could we make something sensible with this? I have it working now, but I did not succeed in making it recognize ${prefix}/share/abaddon
path for resources – and had to dump the binary together with those two folders into a dedicated prefix. This is undesirable, though I could perhaps hack around that by adding a wrapper which would run from ${prefix}/bin
and pull everything from wherever.
this is the part responsible for getting the resources directory https://github.com/uowuo/abaddon/blob/5e382b11dce3892a3b6d2ea42bc3be0db79c2ef5/src/platform.cpp#L159-L179
i didnt write it, but i think the macos code there is for when its in a .app form?
i can change it to check ABADDON_RESOURCE_DIR
too. what would be the right way to determine ${prefix}
in your examples? on linux its $XDG_DATA_HOME
(usually $HOME/.local/share
). same thing?
i didnt write it, but i think the macos code there is for when its in a .app form?
Possibly (this is not something I understand well), but the build does not produce an app bundle.
If ABADDON_RESOURCE_DIR
can be passed to CMake so that is recognized and used by the build, that will solve the problem.
As a default value, I would expect a path relative to CMAKE_INSTALL_PREFIX
(which is either chosen by a package system or manually by a user). Usually it will be ${CMAKE_INSTALL_PREFIX}/share/${name}
for resources, or something similar. (As long as custom setting is possible, default behavior does not matter too much.)
If you would like the default installation to go into home folder, that can be done then by making it a default value for CMAKE_INSTALL_PREFIX
if it is not specified by a user.
P. S. I had to use wrappers to make this work, it is kinda ugly (though the first one, for libstdc++
case, is unavoidable):
https://github.com/macports/macports-ports/blob/d6a202a84122d1faa7105f2a360506343a93b81c/net/abaddon/Portfile#L107-L140
Ouch, blame me haha. It's all been set up to work for it being packaged and me having no proper experience did it in a way that worked for me.
I guess we need need this either to be configurable or the code to search for both (bundle paths and normal Unix paths).
Why would anyone want to dump some random support files into
${prefix}/bin
together with the binary? But this is where they are looked for, since apparently the build system ignoresABADDON_RESOURCE_DIR
on macOS, and instead uses a relative.
. So nothing gets found on the app launch.The same will happen on any *BSD, since there is no macro for them, so “unknown OS” will be used, which is again
.
.This is arguably a strange default, but at least, perhaps, let the user set the correct location?