-
-
Notifications
You must be signed in to change notification settings - Fork 587
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
Issue with watching directory with name including glob characters #300
Comments
There is no option to disable glob matching. For filenames that use glob characters it should work as that issue has been reported in the past (by you iirc) and fixed. It may be necessary to look into a similar fix for directory names. However, I'm not sure why the example you've provided wouldn't already work. |
Yes, this is an issue for folders I want to watch on that contain glob
|
Can you provide a more realistic example? |
Wait, what? How can you say a valid folder name which chokidar cannot watch is not a realistic example :)? |
I'm saying that given This wouldn't be the case for any glob-like name, so I'm interested in your actual example. |
Hm, I was running an example on my Mac with latest chokidar watching a folder foo* that was actually on disk (~/Desktop/foo*) and I did not receive file events. I can try again later when I am back at my Mac to post a snippet here, but I thought the issue was more obvious. |
@es128 Here are the steps:
var chokidar = require("chokidar");
var watcher = chokidar.watch('/Users/<name>/Desktop/bar/foo*');
watcher.on("all", function(event, path) {
console.log(event, path);
}); |
The question here is: the |
The folder in question was "js* - rewrite" by a colleague of mine using Visual Studio Code, complaining file events do not work. So yeah, this is real! |
We have hit the same issue in wallaby.js. Here is what we do: let Watcher = require('chokidar').FSWatcher;
let watcher = new Watcher({ cwd: '/downloads/project (1)' });
watcher.add('test/**/*.js');
watcher.on('add', p => console.log(p)); So while |
I have the same issue with brackets /Dropbox/Photos (Tony)/ - this is very common i'd think |
I have the same issue with watching a folder containing '!' character, for example 'c:\Works!tests' - changes for files in such folder are not watched. Is there any workaround for this (except renaming the folder)? |
Hi all, I want to help with this issue, will try to reproduce mentioned cases and return with results in few days:) |
Meh, too busy, take a pause with this( |
C'mon! If you claim to support glob syntax, support escaping too.Or at least add an option to disable globs. |
Agree. |
cokidar doesn't like paths which contain glob patterns. See paulmillr/chokidar#300 Prefer relative paths to make problems less likely.
@es128 @paulmillr can you point me to the location in code where a folder is being treated as glob pattern when found on disk? I would like to disable this in my fork of chokidar |
Any news on this? Also a default-off option is welcome. I see there's already a PR, but it was not accepted. Atm I can't use |
Problems with parentheses will be solved by #535 once the apparent windows issues there are resolved. A different fix will still be needed for other sorts of glob characters like asterisks. |
Still broken on Windows? I can't find details about the issue on Windows, can you explain? |
There is no clear way to work around this issue on Windows, where the following are all valid folder names but are indistinguishable from globs:
The latest is-glob supports escaping glob characters with backslash, but of course that doesn't work on Windows because backslash is the path separator. Has anyone done the work to add an option to disable globbing globally? If not, would you accept a pull request to add a global option to disable globs? It would be such a minimal change and would solve a lot of people's problems. |
Maybe, but it might not be as simple as you think. I'm more eager for a PR that updates to is-glob@3 and solves the related windows issues that show up in the tests when doing so.
Forward slash is also a valid path separator on Windows, so it can work. But yes, it is sometimes tricky when also using stuff like |
My naive approach would be to skip the
How could any possible update to
I don't think you want to force Windows users to use forward slashes in all their paths. That would create a lot more issues than it solves. |
Try the naive approach, let's see what happens. Honestly, I don't remember what the gotchas were when I've looked at this in the past. Updating is-glob would allow the possibility of at least escaping the special characters - a viable workaround for this edge case. It would not require all windows paths to use forward slashes. But I agree with your perspective that any solution cannot knowingly impact other users who are not currently having problems. |
The |
Very nice, thanks! |
@es128 Will there be a new release soon? |
Yes |
Since Haven't tested but.. Maybe escape everything but * and ** ( |
=> it will not work because foo* is treated as glob pattern
How is it possible to use a path "as is" without glob smartness?
The text was updated successfully, but these errors were encountered: