--config flag doesn't handle ~ for home dir
$ exercism --config=~/hello.json configure --key=abc123
2015/01/11 19:49:00 open ~/hello.json: no such file or directory
vs
$ exercism --config=/tmp/hello.json configure --key=abc123
The configuration has been written to /tmp/hello.json
Your exercism directory can be found at /Users/kytrinyx/exercism
The command works if you omit the = for config; which allows the shell to expand the path.
$ exercism --config ~/hello.json configure --key=abc123
The configuration has been written to /Users/cdambrosio/hello.json
Your exercism directory can be found at /Users/cdambrosio/exercism
@chrisdambrosio that seems like a good workaround. We should still have the CLI expand the path though.
How could one set the folder of the configuration file in the current release (v3.0.11)?
I would like to set the configuration folder to be the folder the file exercism.exe is in.
For windows you have chance, other than changing APPDATA, which I wouldn't advice to do. In general, saving the configuration or other user generated data in the installation folder is actively discouraged by Microsoft since the release of windows XP.
You can also set EXERCISM_CONFIG_HOME
Which is not respected when runtime.GOOS is "windows":
https://github.com/exercism/cli/blob/master/config/config.go#L56-L73
For windows you have chance, other than changing
APPDATA, which I wouldn't advice to do. In general, saving the configuration or other user generated data in the installation folder is actively discouraged by Microsoft since the release of windows XP.
This idea is perfect for a computer with multiple users. I'm the sole user on my computer and I prefer each program to be portable. I hate when I format the computer to see programs must be installed and configured again.
@NobbZ Good point.
@RoyiAvital Would it help if we respected the EXERCISM_CONFIG_HOME env var for Windows too? (If so, let's open a new issue that specifies that change).
@kytrinyx , I don't think so.
As if I need to set system Variable I can set %APPDATA.
I thought about an elegant (In my opinion) solution like if the EXE sees a .portable file in the folder it will use the working folder for the configuration file.
This will also mean that every time it has to read the configuration file it will see the file and will understand where to look for the file.
@RoyiAvital I'm not opposed to that solution. Would you open an issue to discuss it?
@kytrinyx @RoyiAvital Would it be necessary to add the .portable file to the folder? Would it not work just as well to have exercism.exe initially look inside the same folder for the user.json file and read the contents from there if the file is found, falling back to reading from %APPDATA if the file can't be found? This would make the solution just as portable and not require an additional file.
@craigtp , Yes, it will work. When I wrote my example it was the concept looking in the working folder before going out. What to look should be engineering decision.
@RoyiAvital Personally, I'd be happy with either approach, as I too would like a completely portable folder for Exercism. I have the exercism.exe file (and required dependencies) and all my source code and a git repo in a single folder. Would be great to be able to simply copy that folder to another PC and have everything "just work". Only thing stopped that currently is the requirement on the user.json file being located in %APPDATA.