RicardoEPRodrigues / 3Engine

Game Engine running using C++, OpenGL and JSON.
https://ricardoeprodrigues.github.io/3Engine/
MIT License
5 stars 1 forks source link

Load Assets from path relative to the executable #6

Open RicardoEPRodrigues opened 6 years ago

RicardoEPRodrigues commented 6 years ago

It'd be best to load assets from a path relative to the main executable, rather than from a path relative to the current working directory (cwd).

https://github.com/RicardoEPRodrigues/3Engine/issues/1#issuecomment-403230211

RicardoEPRodrigues commented 6 years ago

Solution: https://stackoverflow.com/questions/1528298/get-path-of-executable

RicardoEPRodrigues commented 5 years ago

Solution is using the SDL_GetBasePath like so:

#ifdef DEBUG
        char *base_path = SDL_GetBasePath();
        if (base_path) {
            ThreeEngine::Debug::Log("Base Path: %s\n", base_path);
        }
        free(base_path);
#endif
RicardoEPRodrigues commented 1 year ago

https://stackoverflow.com/questions/1528298/get-path-of-executable