-
-
Notifications
You must be signed in to change notification settings - Fork 471
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
Add absolute
option for match event - closes #292
#293
Conversation
If there is anything else you'd like me to tackle as part of this, just let me know. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dug in a little bit, and found some weird bugs in the sync glob in the process. I'm going to pull in this change, but fix those other issues myself before publishing. This is good, expect a release this week. Thanks!
@@ -273,6 +273,9 @@ the filesystem. | |||
In the case of a symlink that cannot be resolved, the full absolute | |||
path to the matched entry is returned (though it will usually be a | |||
broken symlink) | |||
* `absolute` Set to true to always receive absolute paths for the | |||
`'match'` event. Will not pass absolute paths to the callback | |||
or returned from `glob.sync`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's a little bit surprising for the match
events to be absolute, but for the results to still be relative. I'll check out the code to see how hard this is, probably I can at least point you in the right direction.
@@ -80,6 +80,7 @@ function setopts (self, pattern, options) { | |||
self.nocase = !!options.nocase | |||
self.stat = !!options.stat | |||
self.noprocess = !!options.noprocess | |||
self._absolute = !!options.absolute |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my suggestion, I'd forgotten the pattern that this module uses. Probably it should be self.absolute
, to match the other settings.
This involes a refactor of the GlobSync._emitMatch method, which it turns out, was not being used at all. Close #293
Published as 7.1.0. Thanks! |
Awesome! Glad I could help find issues in |
Add absolute option for match event. Credit: @phated PR-URL: isaacs/node-glob#293
@isaacs Implemented as per guidance on #292 - I added a note about the caveat that this is only applied to
'match'
events and not to the final results in the callback. I am not familiar enough with the code to understand the scope of making the final results absolute. Do you think it's a worth including in this feature?