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

frames are randomly ordered when using wgif on ubuntu #19

Closed
aparrish opened this issue Oct 8, 2014 · 3 comments
Closed

frames are randomly ordered when using wgif on ubuntu #19

aparrish opened this issue Oct 8, 2014 · 3 comments

Comments

@aparrish
Copy link

aparrish commented Oct 8, 2014

I installed wgif on ubuntu today and the gifs it made had the frames in essentially random order. I tracked the problem down to this lineaccording to this, .glob isn't guaranteed to return its results in any particular order. If I put a little puts frames_dir.inspect in the make_gif method, I get output like this:

["/tmp/wgif/frames/00042.png", "/tmp/wgif/frames/00013.png", "/tmp/wgif/frames/00002.png", "/tmp/wgif/frames/00004.png", "/tmp/wgif/frames/00003.png", "/tmp/wgif/frames/00028.png", "/tmp/wgif/frames/00051.png", "/tmp/wgif/frames/00049.png", "/tmp/wgif/frames/00050.png", "/tmp/wgif/frames/00024.png", "/tmp/wgif/frames/00005.png", "/tmp/wgif/frames/00052.png", "/tmp/wgif/frames/00041.png", "/tmp/wgif/frames/00045.png", "/tmp/wgif/frames/00038.png", "/tmp/wgif/frames/00034.png", "/tmp/wgif/frames/00033.png", "/tmp/wgif/frames/00044.png", "/tmp/wgif/frames/00022.png", "/tmp/wgif/frames/00011.png", "/tmp/wgif/frames/00026.png", "/tmp/wgif/frames/00040.png", "/tmp/wgif/frames/00017.png", "/tmp/wgif/frames/00036.png", "/tmp/wgif/frames/00007.png", "/tmp/wgif/frames/00025.png", "/tmp/wgif/frames/00039.png", "/tmp/wgif/frames/00014.png", "/tmp/wgif/frames/00029.png", "/tmp/wgif/frames/00043.png", "/tmp/wgif/frames/00019.png", "/tmp/wgif/frames/00030.png", "/tmp/wgif/frames/00027.png", "/tmp/wgif/frames/00053.png", "/tmp/wgif/frames/00035.png", "/tmp/wgif/frames/00001.png", "/tmp/wgif/frames/00006.png", "/tmp/wgif/frames/00010.png", "/tmp/wgif/frames/00021.png", "/tmp/wgif/frames/00012.png", "/tmp/wgif/frames/00016.png", "/tmp/wgif/frames/00031.png", "/tmp/wgif/frames/00020.png", "/tmp/wgif/frames/00023.png", "/tmp/wgif/frames/00046.png", "/tmp/wgif/frames/00047.png", "/tmp/wgif/frames/00008.png", "/tmp/wgif/frames/00032.png", "/tmp/wgif/frames/00015.png", "/tmp/wgif/frames/00009.png", "/tmp/wgif/frames/00018.png", "/tmp/wgif/frames/00048.png", "/tmp/wgif/frames/00037.png"]

(When I run this on OSX, I get the same frames back—but sorted lexicographically.)

I think the fix is pretty easy—just put a .sort on the end of this line. (I made this change in my local copy and it works fine—sorry for no pull request, I don't actually know how to write ruby and I'm not quite sure how I'd write unit/regression tests for this.)

@ecmendenhall
Copy link
Owner

Oh my glob, sorry this easy fix was open for so long! Notifications for this project keep getting lost and I just noticed your issue tonight. 😒

You're totally right: Dir#glob sorts alphabetically on OS X, but not on Linux/Windows. I added your fix and pushed up version 0.5.3 to Rubygems. Looks good on my Ubuntu VM, but I'll wait until you confirm to close the issue.

@aparrish
Copy link
Author

yep, looks good. thanks! no problem on the delay—I had made the fix on my local version without problems, so no damage done.

@ecmendenhall
Copy link
Owner

🎉

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

2 participants