| 73 | } |
| 74 | |
| 75 | override _done(): Observable<void> { |
| 76 | this._fileAlreadyExistExceptionSet.forEach((path) => { |
| 77 | this._subject.next({ |
| 78 | kind: 'error', |
| 79 | description: 'alreadyExist', |
| 80 | path, |
| 81 | }); |
| 82 | }); |
| 83 | this._fileDoesNotExistExceptionSet.forEach((path) => { |
| 84 | this._subject.next({ |
| 85 | kind: 'error', |
| 86 | description: 'doesNotExist', |
| 87 | path, |
| 88 | }); |
| 89 | }); |
| 90 | |
| 91 | this._filesToDelete.forEach((path) => { |
| 92 | // Check if this is a renaming. |
| 93 | for (const [from] of this._filesToRename) { |
| 94 | if (from == path) { |
| 95 | // The event is sent later on. |
| 96 | return; |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | this._subject.next({ kind: 'delete', path }); |
| 101 | }); |
| 102 | this._filesToRename.forEach(([path, to]) => { |
| 103 | this._subject.next({ kind: 'rename', path, to }); |
| 104 | }); |
| 105 | this._filesToCreate.forEach((content, path) => { |
| 106 | // Check if this is a renaming. |
| 107 | for (const [, to] of this._filesToRename) { |
| 108 | if (to == path) { |
| 109 | // The event is sent later on. |
| 110 | return; |
| 111 | } |
| 112 | } |
| 113 | if ( |
| 114 | this._fileAlreadyExistExceptionSet.has(path) || |
| 115 | this._fileDoesNotExistExceptionSet.has(path) |
| 116 | ) { |
| 117 | return; |
| 118 | } |
| 119 | |
| 120 | this._subject.next({ kind: 'create', path, content }); |
| 121 | }); |
| 122 | this._filesToUpdate.forEach((content, path) => { |
| 123 | this._subject.next({ kind: 'update', path, content }); |
| 124 | }); |
| 125 | |
| 126 | this._subject.complete(); |
| 127 | |
| 128 | return of<void>(undefined); |
| 129 | } |
| 130 | } |