-
Notifications
You must be signed in to change notification settings - Fork 99
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
Does not work with square brackets in folder name #60
Comments
This is strange. Here is what you can do: return watch({glob: <glob>}, function(files) {
console.log('Processing', files)
return files.pipe(using())
.pipe(debug());
}); This will catch changed events in this file. |
Unfortunately no differences. Same result.
(I tried also to remove all the logic and left only console output and got same results as well; timeout and emit are set for internal purposes and have no influence also). and this code works excellent while no folders [with_name_like_this] exist in paths, but if I rename any folder to have brackets in the name, it fails. |
Could you test, that gaze is catching events? var gaze = require('gaze');
gaze('public/**/*.cshtml', function(err, watcher) {
this.on('all', function(event, filepath) {
console.log(filepath + ' was ' + event);
});
}); |
Yes, it catches. At least I see 'public[Web.UI][components]\framework\activity\list\list-view.cshtml was changed' with '[]' and without them. |
Thanks, this could be, because gulp.src is not emitting files properly. Could you check also this: var gulp = require('gulp');
gulp.src('public[Web.UI][components]\framework\activity\list\list-view.cshtml')
.on('data', console.log); It would be very helpful. |
It rather interesting. If I use
I see nothing. (I've tried different separators like /, , //)
where
it works and prints
|
Yeah, that's strange. @contra could you look at this? |
Moreover,
works, but
does not (file exists, of course). |
Thanks for investigating, @lexey111! - I think this issue will be moved to vinyl-fs that provides |
As far as I see now, problem is in Globule glob.sync that uses Glob module, that uses Minimatch, that treats path part like [Web.UI] as regexp, but it isn't. And somewhere during the processing escape characters are lost. For single files I can use workaround -
but I don't know how to do this for glob patterns :( |
There is an easy way out - rename your directories 👍 |
I can't - It's not MY directories, so have to use as is. |
Does escaping |
No, it does not. Current state of investigation =) shows: it is required to change minimatch.js function parse, about line 650 such way:
and translate option through all the calls to force minimatch to skip processing [brackets]. But maybe other way exists... it is too low level patch, I'm afraid.Because minimatch is used multiple times/paths in the plugin's tree, and it has to be corrected everywhere... |
Because [ and ] are special characters in a glob, so if you use them directly you will have problems. If you really need a workaround replace them with * for the time being, the bug lies in minimatch Also you could try |
The problem is: I can easily patch the minimatch.js module and can even make new fork, but minimatch is used in my project 12 times via dependencies of other modules. And it have 4 different versions (1.0.0, 0.2.14, 0.3.0, 0.4.0) so I don't know how to solve this problem... and I can't control the minimatch input to replace brackets by * or ?, because on my level I use gulp-watch -> that uses gaze -> that uses globule -> that uses glob (with wildcards) -> that uses minimatch... |
@lexey111 Send a PR to minimatch? |
No, I think it is not an issue of minimatch. Well, frankly speaking it is, but changes only in minimatch module can't solve the problem. My current working solution (very stupid one, I'm afraid, but I have no time to dig deeper) is:
This will replace [-bracket and we'll have valid paths.
...and near if(event === 'deleted') in duplex.gaze.on('all', ...
to has pass-through for changed file (otherwise no passthrough called). It works for me although I think other ways exist =) |
So I think 2 PRs needed:one to gaze and second one here, gulp-watch, but I'd prefer to escalate things to @floatdrop , 'cause I'm not sure my solution is the best one - especially for 2) |
@lexey111 minimatch should be able to escape characters though |
Issue moved to minimatch. |
Hi,
I have a problem with very basic usage:
if folder like
[name]
(with square brackets) exists in the working (glob) path - no 'change' events are fired after very first one. Problem exists on MacOS and Windows.The text was updated successfully, but these errors were encountered: