Fix file path resolution to be portable #20
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In the previous version of the code resources were loaded from either a hardcoded path (the source directory) or the working directory (if a CMake flag was set). This meant that code compiled with a hardcoded string is not portable to other systems and that the working directory version does not work out of the box for simply launching the executable from its own folder. This PR fixes this.
The fix involves creating a config file that CMake fills with the source and build paths and then adding a path resolver (under src/PathFinder.h) that looks at those two paths, which are not portable, but also looks at the current working directory and the directory where the binary is located, which should cover most cases. The resolve also handles paths in the home directory ('~').
To use the resolver: