Skip to content

Standardize & robustify pstoredir path#52

Closed
rlue wants to merge 1 commit intojanfri:masterfrom
rlue:standardize-pstoredir
Closed

Standardize & robustify pstoredir path#52
rlue wants to merge 1 commit intojanfri:masterfrom
rlue:standardize-pstoredir

Conversation

@rlue
Copy link
Copy Markdown

@rlue rlue commented Jan 13, 2025

Fixes #51.

Comment on lines +376 to +379
raise "No writable cache dir found. " +
"Check your home directory's permissions, " +
"or set the MINI_EXIFTOOL_PSTOREDIR env var " +
"and try again."
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to keep the line length to a reasonable minimum, but one downside of splitting long strings up like this is that it makes the codebase harder to grep. What are your thoughts?

"or set the MINI_EXIFTOOL_PSTOREDIR env var " +
"and try again."
else
File.join(cache_home, 'mini_exiftool')
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to keep the code simple, but there are a couple wrinkles with this:

  1. We no longer switch on windows vs. unix. I figured that in most cases, we will be using the value of Gem.cache_home—which typically resolves to $HOME/.cache on UNIX or ENV["HOMEDRIVE"] || ENV["SystemDrive"] + "/.cache" on Windows (src 1 2)—so there's no need to give the directory a special prefix. In the case of our Windows fallbacks, however, now we have a simple mini_exiftool directory instead of _mini_exiftool.

    I don't know anything about software conventions on Windows, so I defer to your expertise here.

  2. This also means that if a user explicitly specifies the pstoredir via a $MINI_EXIFTOOL_PSTOREDIR env var, then the actual location of the pstoredir will be a subdirectory of that. Which is not a problem, really, just maybe a little cluttery and not what you might expect.

I don't know how much either of these problems bothers you. For the former, we could simply restore the original ternary expression (maybe improved as Gem.win_platform? ? _mini_exiftool : mini_exiftool); for the latter, we could rewrite this method to treat ENV['MINI_EXIFTOOL_PSTOREDIR'] separately from all the other options.

@janfri
Copy link
Copy Markdown
Owner

janfri commented Jan 13, 2025

Thanks for your effort and support. I have in the same time implemented a slightly different solution. Let me think a while. I will release a new version of mini_exiftool in the next days.

@rlue
Copy link
Copy Markdown
Author

rlue commented Jan 13, 2025

Oh for sure. Thanks for the free software! 🙇🏻

@rlue rlue closed this Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants