Repository navigation
Systems 6: the Project tree's folders and external edits register with the one watcher #117
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
Changes from all commits
b24d03c
330db57
e5d2534
30cee53
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,8 @@ | ||
| package com.github.minecraft_ta.totalDebugCompanion.ui.components.treeView.lazyFileTree; | ||
|
|
||
| import com.github.minecraft_ta.totalDebugCompanion.util.FileWatch; | ||
| import com.github.minecraft_ta.totalDebugCompanion.ui.Tooltip; | ||
| import com.github.minecraft_ta.totalDebugCompanion.Icons; | ||
| import com.github.minecraft_ta.totalDebugCompanion.util.FileUtils; | ||
|
|
||
| import javax.swing.*; | ||
| import java.io.IOException; | ||
|
|
@@ -34,7 +34,7 @@ public class FileSystemDirectoryItem extends DirectoryTreeItem { | |
| setIcon(Icons.FOLDER); | ||
|
|
||
| this.stopWatching = watch | ||
| ? FileUtils.startNewDirectoryWatcher(path, () -> { | ||
| ? FileWatch.shared().watchEntries(path, () -> { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When a displayed directory is a symlink or Windows junction and its target is deleted and later recreated, this migration leaves the tree stale. After the target's watch key becomes invalid, AGENTS.md reference: AGENTS.md:L19-L19 Useful? React with 👍 / 👎. |
||
| changed = true; | ||
| SwingUtilities.invokeLater(() -> lazyFileJTree.refreshDirectory(path)); | ||
| }) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a later write event or project close occurs after this check but while
Files.readAllBytesis in progress, as can happen with a large or slow resource, the task still callsadoptwith content its generation no longer owns; non-PNG partial bytes can consequently be recorded and reloaded, and an in-flight take can surviveclose(). The fresh race remains after the queued-task fix because validation occurs only before the blocking read; recheckclosedandwrite == file.writesafter reading, asFileReading.readHeredoes before publishing.AGENTS.md reference: AGENTS.md:L19-L19
Useful? React with 👍 / 👎.