-
Notifications
You must be signed in to change notification settings - Fork 109
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
Windows support #24
Comments
I knew that eventually someone would ask about windows support. |
Ok I'm running through the code and almost have it working, but how do I check the temp file?
|
|
The code I'm using is:
|
Temp file will exist only until script finishes: require 'image_optim'
x = ImageOptim.new
y = x.optimize_image('example.jpg').temp_path
puts y
puts "Exists: #{y.exist?}" # should print true Please note that require 'image_optim'
if optimized = ImageOptim.new.optimize_image('example.jpg')
optimized.rename('optimized.jpg')
puts 'Optimized'
else
puts 'Did not optimize'
end Also there are specs to insure that everything works. |
Ok #rename worked perfectly, output was 377kb -> 260kb I'm making all these changes without any backward compatibility or specs atm, lots of stuff to change like .shellescape/.shelljoin won't work on windows, permissions errors etc. |
https://github.com/Arcovion/image_optim/commits/master Status: Fails all tests and doesn't work 😁 However, this works:
Saves I need to know how to ensure the filepaths for the binary commands are always put in quotes instead of escaped (windows requires any paths with spaces in to be quoted, and spaces not be escaped with backslashes), and I'm not sure what the How would I go about refactoring #replace to do what my script does above? |
Changes should be only in I've already learned that |
So it essentially works now The only thing it requires is that the binaries are in PATH. (
Now I was able to run Currently, I can't work out how to fix
Windows users can use the Edit: Windows doesn't let you move/copy/rename files while they're open, this is the issue I think. Would probably just need to patch #replace |
Closing, having all the binaries in |
Should work on windows, have a look at ae01fef |
Would be really nice to have this in windows, all the binaries exist for windows in some form.
Currently I tried setting
line 47
ofbin_resolver.rb
to true and now all I get isThe system cannot find the path specified.
with no traceroute or easy way to debug it.It's probably because it can't find the .exe files even though they are in
PATH
andgems\image_optim-0.10.0\vendor
.Also
bin_resolver.rb
uses symlinks which are not supported in ruby on windows.Maybe it's possible to extensively patch that one file and fix everything?
If not then I guess windows support may never happen, but I accept that. 😢
The text was updated successfully, but these errors were encountered: