Skip to content

Commit 70bb91e

Browse files
facchinmcmaglie
authored andcommitted
Avoid firing watcher if it failed to start proviously
In case of low inotify watch level, simply avoid doing anything. Backing storage will be uncorrelated with the sketch content (as before) TODO: maybe add a notification about this event
1 parent 1e6804a commit 70bb91e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

app/src/processing/app/Editor.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ public class Editor extends JFrame implements RunnerListener, FocusListener {
9696
private final Box upper;
9797
private ArrayList<EditorTab> tabs = new ArrayList<>();
9898
private int currentTabIndex = -1;
99+
private static boolean watcherDisable = false;
99100

100101
private static class ShouldSaveIfModified
101102
implements Predicate<SketchController> {
@@ -1992,6 +1993,10 @@ protected boolean handleOpenInternal(File sketchFile) {
19921993
// Disable untitled setting from previous document, if any
19931994
untitled = false;
19941995

1996+
if (watcherDisable == true) {
1997+
return true;
1998+
}
1999+
19952000
// Add FS watcher for current Editor instance
19962001
Path dir = file.toPath().getParent();
19972002

@@ -2002,7 +2007,7 @@ public void run() {
20022007
try {
20032008
new WatchDir(dir, true).processEvents(instance);
20042009
} catch (IOException x) {
2005-
System.err.println(x);
2010+
watcherDisable = true;
20062011
}
20072012
}
20082013
};

0 commit comments

Comments
 (0)