Skip to content

Commit

Permalink
fixed #418
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarotero committed May 25, 2023
1 parent 3aec156 commit eef1c93
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Any BREAKING CHANGE between minor versions will be documented here in upper case
### Fixed
- Ignore `/.git` folder by the watcher.
- Don't show the full path of the files in the output.
- Don't remove unchanged files [#418].

## [1.17.3] - 2023-05-10
### Fixed
Expand Down
26 changes: 15 additions & 11 deletions core/fs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,21 +75,25 @@ export default class FS {
this.#walkRemote();
}

/** Update the entry and returns it if it was removed */
update(path: string): Entry | undefined {
let entry;

try {
entry = this.entries.get(path) || this.addEntry({ path });
entry.removeCache();
// Remove if it doesn't exist
entry.getInfo();
} catch (error) {
if (error instanceof Deno.errors.NotFound) {
this.removeEntry(path);
const entry = this.entries.get(path);

if (entry) {
try {
entry.removeCache();
entry.getInfo();
return;
} catch (error) {
// Remove if it doesn't exist
if (error instanceof Deno.errors.NotFound) {
this.removeEntry(path);
return entry;
}
}
}

return entry;
this.addEntry({ path });
}

#isValid(path: string) {
Expand Down

0 comments on commit eef1c93

Please sign in to comment.