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

Folder with partial name loaded AFTER folder with full name except when using a dash? #4300

Closed
dalgard opened this Issue Apr 30, 2015 · 4 comments

Comments

Projects
None yet
2 participants
@dalgard

dalgard commented Apr 30, 2015

I seemed to be having some problems with load order, so I tested it by placing a file (test.js) in each folder containing only the line console.log("<folder name>") – here sorted by the OS:

  • /modules/myproj/test.js
  • /modules/myproj-accounts/test.js
  • /modules/myproj-app/test.js
  • /modules/myproj-app-accounts/test.js

To my great chagrin, this was the output in both server and browser console:

myproj-accounts
myproj-app-accounts
myproj-app
myproj

However, if I append a dash/hyphen to the two names that are moving place:

  • /modules/myproj-/test.js
  • /modules/myproj-accounts/test.js
  • /modules/myproj-app-/test.js
  • /modules/myproj-app-accounts/test.js

... it gives the expected result:

myproj
myproj-accounts
myproj-app
myproj-app-accounts

What gives???

I'm running OS X 10.9.5.

@dalgard dalgard changed the title from Short folder name loaded AFTER long except when using a dash? to Folder with partial name loaded AFTER folder with full name except when using a dash? Apr 30, 2015

@benjamn benjamn self-assigned this May 5, 2015

@benjamn

This comment has been minimized.

Member

benjamn commented May 5, 2015

I was able to reproduce this bug, and I hope to have a fix soon!

@dalgard

This comment has been minimized.

dalgard commented May 5, 2015

Fantastic! I thought I was missing something.

@benjamn

This comment has been minimized.

Member

benjamn commented May 5, 2015

The root cause is that - comes before / alphabetically, so I think we should be splitting on / and comparing each pair of path components individually.

@dalgard

This comment has been minimized.

dalgard commented May 5, 2015

Wouldn't it be enough to replace / with a character that is sure to come before all other legal file system characters, i.e. anything before 0x0a, roughly?

benjamn added a commit that referenced this issue May 5, 2015

Split on path separator before comparing files alphabetically.
We should be doing a lexicographical comparison of path components, rather
than including the `/` characters in the comparison, to match the order
given by the Unix `find` or `ls` commands.

Fixes #4300.

@benjamn benjamn closed this in #4328 May 5, 2015

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