warn users about libraries with the same name

This commit is contained in:
Ben Fry
2023-01-21 12:16:05 -05:00
parent c170cf1e67
commit a5d0afe91c
2 changed files with 29 additions and 2 deletions
+23 -1
View File
@@ -1,5 +1,6 @@
package processing.app;
import java.awt.EventQueue;
import java.io.*;
import java.util.*;
import java.util.zip.ZipFile;
@@ -619,12 +620,33 @@ public class Library extends LocalContribution {
}
static Set<String> duplicateLibraries = new HashSet<>();
static public List<Library> list(File folder) {
List<Library> libraries = new ArrayList<>();
List<File> librariesFolders = new ArrayList<>(discover(folder));
Map<String, File> seen = new HashMap<>();
for (File baseFolder : librariesFolders) {
libraries.add(new Library(baseFolder));
Library lib = new Library(baseFolder);
String name = lib.getName();
File foundEarlier = seen.get(name);
if (foundEarlier != null) {
// Warn the user about this duplication (later, on the EDT)
if (!duplicateLibraries.contains(name)) {
Messages.showWarningTiered("Duplicate Library Found",
"There are multiple libraries named “" + name + "",
"Please remove either “" + foundEarlier.getName() +
" or “" + lib.getName() + "\n" +
"from " + folder.getPath() + "\n" +
"and restart Processing.", null);
}
duplicateLibraries.add(name);
} else {
seen.put(name, lib.getFolder());
libraries.add(lib);
}
}
return libraries;
}
+6 -1
View File
@@ -12,11 +12,16 @@ X oops those are in fact used
X many more updates to the contribs wiki
X more contribs manager concurrency problems
X https://github.com/processing/processing4/issues/640
X warn users about multiple libraries with the same name
_ Updates requiring a reboot give the false impression that they failed (in the updates tab)
_ https://github.com/processing/processing4/issues/647
_ lots of folders remaining in 'old' for Modes
_ were these shut off during debug? need to be moving these to trash (maybe only on startup)
design
X tool tips for errors/warnings not picking up correct colors
X also fix the margins and border
_ use down arrow for updates, circle arrow for restart?
_ completion mode pop-up not following dark and light mode conventions
_ update console.scrollbar.thumb.rollover.color and console.scrollbar.thumb.pressed.color
_ currently just using .enabled.color because they weren't in ColorSet