Currently, when building my application using packr, the executable loads the configuration file relative to the current working directory.
So when having a file structure like this...
- Desktop
- <App>Build << current working directory
- <App>.exe
- <App>.json << the configuration is here - executable expects configuration to be here
- DifferentDirectory
- test.png
- ...
It works fine.
But if the current working directory is changed...
- Desktop
- <App>Build
- <App>.exe
- <App>.json << the configuration is here
- DifferentDirectory << current working directory
- test.png
- ... << executable expects configuration to be here (it is not)
The executable suddenly does not know where the configuration file is.
That is to be expected, as it seems to be looking in the current working directory.
I am building a command line app and want to be able to put the executable inside of the PATH, so that I call it from anywhere on my system. Running the executable fails, because it cannot find the configuration file.
Error: failed to load configuration: <App>.json
Is there some way to tell it to look where the executable is stored, not where the executable is run?
Currently, when building my application using packr, the executable loads the configuration file relative to the current working directory. So when having a file structure like this...
It works fine. But if the current working directory is changed...
The executable suddenly does not know where the configuration file is. That is to be expected, as it seems to be looking in the current working directory.
I am building a command line app and want to be able to put the executable inside of the PATH, so that I call it from anywhere on my system. Running the executable fails, because it cannot find the configuration file.
Is there some way to tell it to look where the executable is stored, not where the executable is run?