Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pistol.conf isn't loaded on OS X #36

Closed
duganchen opened this issue Sep 20, 2020 · 8 comments
Closed

pistol.conf isn't loaded on OS X #36

duganchen opened this issue Sep 20, 2020 · 8 comments

Comments

@duganchen
Copy link
Contributor

duganchen commented Sep 20, 2020

I'm wondering if this is the issue behind this one:

#19

I've noticed that on OS X, ~/.config/pistol/pistol.conf isn't loaded.

I have the following in ~/.config/pistol/pistol.conf:

image/* viu %pistol-filename%

If I just run pistol against a image, the setting doesn't take effect:

▶ pistol Lohse-3840x2160.jpg
JPEG image data, Exif standard: [TIFF image data, little-endian, direntries=0], baseline, precision 8, 3840x2160, components 3

(That's Divinity: Original Sin 2 wallpaper, if you're wondering).

But if I force it to load pistol.conf,

▶ pistol -c ~/.config/pistol/pistol.conf Lohse-3840x2160.jpg

Then I see the image in the terminal.

@doronbehar
Copy link
Owner

What does pistol --help says on OS X?

@duganchen
Copy link
Contributor Author

❯ pistol --help
Usage: /Users/dugan/go/bin/pistol OPTIONS [<file> ...]

OPTIONS

-V, --version               Print version date and exit
-c, --config <config file>  configuration file to use (defaults to ~/.config/pistol/pistol.conf)
-h, --help                  print help and exit

ARGUMENTS

file                        the file to preview

@duganchen
Copy link
Contributor Author

duganchen commented Sep 21, 2020

I'm not sure why you asked that, as the path in "pistol --help" is a hardcoded string.

I know what's wrong though.

adrg/xdg simply doesn't recognize ~/.config as a user configuration directory on OS X. It only recognizes (and searches) ~/Library/Preferences.

That library searches ~/.config on Linux, ~/Library/Preferences on OS X. Compare:

https://github.com/adrg/xdg/blob/master/paths_darwin.go#L11
https://github.com/adrg/xdg/blob/master/paths_unix.go#L15

So on OS X, Pistol currently would find the configuration file only at the following two paths:

  • ~/Library/Preferences/pistol.conf
  • ~/Library/Preferences/pistol/pistol.conf

@doronbehar
Copy link
Owner

You are right, that path was indeed hardcoded. Now it is not, and --help reflects the real paths that are supposed to be used. Thanks for the report.

BTW is this surprising to you as an OS X user to use a program with such an XDG assumption? Because other golang xdg implementations use the same path for OS x - https://github.com/kyoh86/xdg & https://github.com/OpenPeeDeeP/xdg .

@duganchen
Copy link
Contributor Author

I'd certainly say that that resolves it. 👍

As for whether the correct OS X XDG path surprises me: I mainly have a Linux background and I'm the wrong OS X user to ask.

@luisdavim
Copy link

Can you also update the readme?

@doronbehar
Copy link
Owner

Can you also update the readme?

Yes :) Thanks.

@luisdavim
Copy link

BTW, I've been using macOS for some time now and this was a surprise to me, most apps I use store their config in ~/.config/ I've also noticed that helm started using the ~/Library/ path after v3 maybe this came with some more recent version of macOS or only now developers are starting to adopt it...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants