-
Notifications
You must be signed in to change notification settings - Fork 0
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
[CLOSED] [File Watchers] Can not externally rename a directory with subfolders on Windows #5955
Comments
Comment by jasonsanjose
|
Comment by iwehrman So Windows doesn't like the rename? Is the hypothesis that the Node watcher is somehow locking the directory? I have no idea how Windows filesystem locking works. |
Comment by dangoor I ran Process Explorer and it confirmed that brackets-node has a handle on the directory that I moved. |
Comment by peterflynn
|
Comment by jasonsanjose Not exactly sure what you mean about the notification. Can you clarify? |
Comment by jasonsanjose I don't remember seeing this earlier, but now if I load a simple tree 2 levels deep...
...and I try to rename |
Comment by jasonsanjose
|
Comment by jasonsanjose Tested with Node 0.11.10 and the problem still exists. |
Comment by iwehrman The available options are unpalatable:
The best option in my opinion is 2. The downside is that it will require some additional code. The upside is that it will probably leave the filesystem code in a better state overall, since there's no particular reason why we shouldn't have the proposed caching policy already for unwatched directories except for the added complexity. Side note: although the aforementioned Node issue would indicate that this is impossible on Windows, I frankly don't believe that. I bet it works in Sublime somehow or another. It would be nice to know how. CC |
Comment by peterflynn This is confusing. If I have Sublime open, it lets me rename folders with folder children, yet it still detects the rename instantly. Windows Explorer itself it obviously also able to do this. So it seems like there's some Windows API that has the behavior we want... Could they really both be doing the super inefficient one-watcher-per-file thing?? |
Comment by iwehrman Because Explorer can do it efficiently, it seems very likely that the answer is that there exists an API that libuv doesn't use. Also, if they're spinning up a watcher-per-visible-file, they still need a way to watch for new files... |
Comment by peterflynn We've identified at least four promising-sounding options that might allow efficient watching without locking most (or any) folders... It does seem like there's a good chance libuv is simply 'doing it wrong' -- Windows isn't really a top-priority platform for Node, and the main native watching API is apparently pretty complicated to use effectively: E.g., from http://qualapps.blogspot.com/2010/05/understanding-readdirectorychangesw.html
So at this point we just need to proove out which alternative is going to work well, and then start thinking about how that fits into our desire to ship a Brackets update relatively soon... |
Comment by jasonsanjose FYI this was also tested on Mac and Linux...both are unaffected. |
Comment by bchintx Pull requests #6673 and #412 should fix this issue. Per This new node-module replaces Brackets' previous use of node's fs.watch() with a Windows-native implementation of the same ReadDirectoryChangesW() function, but leveraging the 'recursive' flag. So, on Windows, we now only have to set a single watcher at the project root level, rather than having to iterate thru and set individual fs.watch() watchers for each subfolder within the project. As a result, the observed "in-use" issues disappear. Per FYI... one side benefit of only setting a watcher on the project's root folder is that we now also lock that folder so that it can't be deleted or renamed out from under us while it's open within Brackets. :-) |
Comment by ackalker Does anyone have some smart comments on http://timgolden.me.uk/python/win32_how_do_i/watch_directory_for_changes.html ? |
Comment by bchintx
So, in this implementation, we've chosen to not use this flag, and so Brackets will be locking the root of the project folder (and its parent folder). However, since we are now able to recursively watch all subfolders with a single-watcher, we've fixed the problem of not being able to externally rename/delete folders within the project itself. (IMHO, it's actually a positive that we're now locking the root of the project folder so that it won't be moved/deleted out from underneath us as easily.) |
Comment by bchintx The Pull Requests have been merged into the |
Comment by jasonsanjose Confirmed fix on release build 0.37.0-11591 (build number to be fixed soon right?) |
Issue by jasonsanjose
Thursday Jan 16, 2014 at 04:37 GMT
Originally opened as adobe/brackets#6551
UPDATE: I don't remember seeing this earlier, but now if I load a simple tree 2 levels deep...
...and I try to rename folder externally, I get the "folder in use" dialog.
Old Description:
While debugging #6537, I found the following...
If, external to brackets, I copy in a folder with a subfolder into my project, then externally try to rename the folder that I pasted, windows prevents me from doing so with this warning:
Note that this only happens for externally added folders that include a subfolder. Pasting in a folder with no subfolders doesn't reproduce the issue. I assume that the file watcher for the subfolder is what is holding a file lock.
This may be a sprint 36 blocker.
cc
@
iwehrman@
peterflynn@
gruehleThe text was updated successfully, but these errors were encountered: