cli icon indicating copy to clipboard operation
cli copied to clipboard

./cli.json on windows executable resolves to current working directory instead of path relative to .exe.

Open Claudiohbsantos opened this issue 6 years ago • 7 comments

After running init and selecting to save the configs to ./cli.json the executable is unable to find the config file unless the console working directory is the executable's directory. In fact, I believe the ./cli.json file is saved to whichever working directory you have active when initis run.

Not sure if this is the intended functionality but I expected it to save to the same directory as the .exe file and to always be loaded from there regardless of my working directory.

As a temporary fix I created a batch script that I am using to call the cli app from anywhere with the expected behavior. I'm posting it here in case anyone finds this thread and needs an immediate fix.

gotify.bat
-----------------
@echo off
pushd %~dp0
Call %~dp0\gotify-cli-windows-amd64.exe p -q %* 
popd

The scripts needs to be placed on the same directory as the executable to work as is.

Claudiohbsantos avatar Dec 28 '18 06:12 Claudiohbsantos

Hey @Claudiohbsantos, I haven't really thought about this, but looking for the config file in the same dir as the executable seems like the better approach.

jmattheis avatar Dec 28 '18 16:12 jmattheis

Here on Linux, I've encountered a related issue which was not present in previous versions. My always used ~/.gotify/cli.json is not read anymore and when I run gotify init it suggests to me to put the new cli.json either in /etc/gotify/cli.json or the current directory (./cli.json). I'm sorry but that just doesn't make sense..

Now I'm using /etc/gotify/cli.json but it would have been better to use the original, user owned ~/.config/gotify/cli.json.

doronbehar avatar Apr 26 '19 10:04 doronbehar

I agree. @doronbehar

/cc @jmattheis

Are you interested in opening a PR for this? :)

eternal-flame-AD avatar Apr 26 '19 10:04 eternal-flame-AD

I think this is already fixed with https://github.com/gotify/cli/commit/61a3e6c290f6145b12a6eda94db6063822232ea3 this isn't released yet, but I'll do this now.

jmattheis avatar Apr 26 '19 10:04 jmattheis

I think he was talking about making the user config directory as the default location to store config files.

eternal-flame-AD avatar Apr 26 '19 11:04 eternal-flame-AD

I think it is mainly about the ~/.config/gotify/cli.json configy. Since v2.0.0 the config was ignored (due to a bug) but this is now fixed in 2.1.0.

jmattheis avatar Apr 26 '19 12:04 jmattheis

Okay, I re-read the comment and it seems that you are right. I will open a new issue to track my proposal.

eternal-flame-AD avatar Apr 26 '19 12:04 eternal-flame-AD