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

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 · Fixed by #4328
Closed
Assignees
Labels
confirmed We want to fix or implement it Project:Tool

Comments

@dalgard
Copy link

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 Short folder name loaded AFTER long except when using a dash? 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 benjamn added confirmed We want to fix or implement it Project:Tool labels May 5, 2015
@benjamn
Copy link
Contributor

benjamn commented May 5, 2015

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

@dalgard
Copy link
Author

dalgard commented May 5, 2015

Fantastic! I thought I was missing something.

@benjamn
Copy link
Contributor

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
Copy link
Author

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
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed We want to fix or implement it Project:Tool
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants