修复 文件夹监控逻辑
This commit is contained in:
1 parent
3d62398a8e
commit
79816a7316
4 files changed
+97
-13
No files matched your search
@@ -97,22 +97,27 @@ class FileWatcher {
|
||||
_handleWorkerMessage(libraryId, library, msg) {
|
||||
switch (msg.type) {
|
||||
case 'add':
|
||||
console.log(`[FileWatcher] File added: ${msg.path}`);
|
||||
this._getBuffer(libraryId).filesAdded.add(msg.path);
|
||||
this._debouncedSync(libraryId, library);
|
||||
break;
|
||||
case 'unlink':
|
||||
console.log(`[FileWatcher] File removed: ${msg.path}`);
|
||||
this._getBuffer(libraryId).filesRemoved.add(msg.path);
|
||||
this._debouncedSync(libraryId, library);
|
||||
break;
|
||||
case 'change':
|
||||
console.log(`[FileWatcher] File changed: ${msg.path}`);
|
||||
this._getBuffer(libraryId).filesChanged.add(msg.path);
|
||||
this._debouncedSync(libraryId, library);
|
||||
break;
|
||||
case 'addDir':
|
||||
console.log(`[FileWatcher] Directory added: ${msg.path}`);
|
||||
this._getBuffer(libraryId).dirsAdded.add(msg.path);
|
||||
this._debouncedSync(libraryId, library, true);
|
||||
break;
|
||||
case 'unlinkDir':
|
||||
console.log(`[FileWatcher] Directory removed: ${msg.path}`);
|
||||
this._getBuffer(libraryId).dirsRemoved.add(msg.path);
|
||||
this._debouncedSync(libraryId, library, true);
|
||||
break;
|
||||
|
||||
Reference in new issue
Block a user