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

Gem doesn't work on Windows #31

Open
sroller opened this issue Feb 28, 2023 · 4 comments
Open

Gem doesn't work on Windows #31

sroller opened this issue Feb 28, 2023 · 4 comments

Comments

@sroller
Copy link

sroller commented Feb 28, 2023

The gem doesn't recognize the exiftool command even when it's installed.
That's because Windows' null device doesn't follow the POSIX rules.

I added the gem 'os' to the file exiftool.rb.

require 'os'

I changed line #60 to

cmd = "#{self.class.command} #{exiftool_opts} -j -coordFormat \"%.8f\" #{escaped_filenames} 2> #{OS.dev_null}"

and that did it for me.

@sroller
Copy link
Author

sroller commented Feb 28, 2023

Turns out there are other more issues to solve.
The Shellwords.escape method doesn't work as expected either.
The best way I found was to put each file within "A filename with spaces.jpg".
That has to be followed by a change from join(' ') to join('" "') and additional quotes around the list of filenames in the cmd varialble.

The output of the exiftool on Windows doesn't match what's in the expected folder. Therefore the tests aren't green.
I hoped I could send a merge request, but it's too early.
it's messy :-(.

Do you have routine to turn the output of exiftool into yaml format for the expect files?

@morozgrafix
Copy link
Member

@sroller thanks for digging into it. I haven't touched the code for this gem in a while, with exception of the minor housekeeping tasks. I will try to find some time to look into exiftool output -> yaml question and get back to you. Please keep me posted on developments on your side of things and I'm happy to discuss potential changes.

@morozgrafix
Copy link
Member

I believe that additional output key/value pairs that you may see on Windows can be added to keys to be ignored during tests in exiftool_test.rb line 9
There is also another spot where we use /dev/null and it would need to be based on OS used.
And last issue is related to spaces in paths/filenames as you've mentioned - that's a little messy.

@mceachen
Copy link
Member

mceachen commented Feb 6, 2024

I'm the original author of this gem (I stopped using ruby more than a decade ago).

Kudos to @morozgrafix for keeping it alive! 💪

Windows filename support will at least require shenanigans like this: https://github.com/photostructure/exiftool-vendored.js/blob/main/src/FilenameCharsetArgs.ts

(I had to add a bunch of example filenames with different unicode block classes, and add windows to my GHA test matrix, and even then, there are issues with some multi-character emoji in filenames).

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

No branches or pull requests

3 participants