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

it has an error in my project(windows) #12

Closed
subying opened this issue Nov 1, 2016 · 5 comments
Closed

it has an error in my project(windows) #12

subying opened this issue Nov 1, 2016 · 5 comments

Comments

@subying
Copy link

subying commented Nov 1, 2016

my code

var globParent = require('glob-parent');
var _glob = 'C:\\Users\\ys\\mf\\src\\html\\*.html';
var _base = globParent(_glob); // return '.'

I read the source,in win32,it must use pathDirname.win32 ,why it can not auto match the windows?

@es128
Copy link
Contributor

es128 commented Nov 1, 2016

Backslashes are not valid in globs, and when put it next to the asterisk the glob parser thinks you're trying to escape it rather than use it as a wildcard. Working on solving for cases like this in #11, but in the meantime you should switch to using only forward-slashes as path separators in your glob patterns.

@subying
Copy link
Author

subying commented Nov 2, 2016

Thanks. I found this problem in gulp-watch@4.3.10,i don't use the backslashes,but in the module,it changed the Slash to backslashes.

@UltCombo
Copy link

It is odd that backslashes were working with glob-parent in Node <= 6, but stopped working (gulp-watch build started failing) on Node 7.

To whom it may concern, gulp-watch@4.3.11 now supports Node v7. The issue has been fixed by this commit.

Thanks @es128 for the detailed information and @subying for diligently reporting the issue in both repositories.

@subying subying closed this as completed Nov 19, 2016
@es128
Copy link
Contributor

es128 commented Nov 19, 2016

@UltCombo I'm not sure what node v6 vs v7 distinction you're seeing, but there was definitely a difference in glob-parent 2.x vs 3.x in the support for glob escape characters, useful when real file paths contain glob-relevant characters.

Looks like your commit in gulp-watch may have an impact on allowing that feature to work on Windows. There is a proposed solution here in #13 if you're interested.

@UltCombo
Copy link

Thanks for the heads-up. Indeed, escaping can be a problem.

Backwards compatibility with backslash dir separators is very important for gulp-watch, and that's what I have prioritized. However, escaping is also an use case that should be addressed.

I'll join the discussion at #13 and add more information.

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

3 participants