Git Product home page Git Product logo

Comments (5)

barracuda156 avatar barracuda156 commented on June 3, 2024

@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.

from abaddon.

ouwou avatar ouwou commented on June 3, 2024

this is the part responsible for getting the resources directory

abaddon/src/platform.cpp

Lines 159 to 179 in 5e382b1

std::string Platform::FindResourceFolder() {
static std::string found_path;
static bool found = false;
if (found) return found_path;
CFURLRef resourceURL = CFBundleCopyResourcesDirectoryURL(CFBundleGetMainBundle());
char resourcePath[PATH_MAX];
if (CFURLGetFileSystemRepresentation(resourceURL, true, (UInt8 *)resourcePath, PATH_MAX)) {
if (resourceURL != NULL) {
CFRelease(resourceURL);
}
found_path = resourcePath;
found = true;
return found_path;
}
spdlog::get("discord")->warn("cant find a resources folder, will try to load from cwd");
found_path = ".";
found = true;
return found_path;
}

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?

from abaddon.

barracuda156 avatar barracuda156 commented on June 3, 2024

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

from abaddon.

TheMorc avatar TheMorc commented on June 3, 2024

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.

from abaddon.

barracuda156 avatar barracuda156 commented on June 3, 2024

I guess we need need this either to be configurable or the code to search for both (bundle paths and normal Unix paths).

from abaddon.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.