Skip to content

Commit

Permalink
Change default pstore_dir to subdir in Gem.cache_home
Browse files Browse the repository at this point in the history
So it's now XDG conform and also Ruby ecosystem conform.
  • Loading branch information
janfri committed Jan 13, 2025
1 parent f6ce109 commit 614349c
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions lib/mini_exiftool.rb
Original file line number Diff line number Diff line change
Expand Up @@ -366,10 +366,15 @@ def self.unify tag

def self.pstore_dir
unless defined? @@pstore_dir
# This will hopefully work on *NIX and Windows systems
home = ENV['HOME'] || ENV['HOMEDRIVE'] + ENV['HOMEPATH'] || ENV['USERPROFILE']
subdir = @@running_on_windows ? '_mini_exiftool' : '.mini_exiftool'
@@pstore_dir = File.join(home, subdir)
@@pstore_dir =
if defined?(Gem.cache_home) && File.writable?(Gem.cache_home)
File.join(Gem.cache_home, 'mini_exiftool')
else
# This fallback will hopefully work on *NIX and Windows systems
home = ENV['HOME'] || ENV['HOMEDRIVE'] + ENV['HOMEPATH'] || ENV['USERPROFILE']
subdir = @@running_on_windows ? '_mini_exiftool' : '.mini_exiftool'
File.join(home, subdir)
end
end
@@pstore_dir
end
Expand Down

0 comments on commit 614349c

Please sign in to comment.