Skip to content

Commit fa95662

Browse files
committed
Disabled 'fat' (multiplatform) library check.
Conflicts: app/src/processing/app/Base.java
1 parent 8266ac5 commit fa95662

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

app/src/processing/app/Base.java

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2381,7 +2381,7 @@ public void handleAddLibrary(Editor editor) {
23812381
JFileChooser fileChooser = new JFileChooser(System.getProperty("user.home"));
23822382
fileChooser.setDialogTitle(_("Select a zip file or a folder containing the library you'd like to add"));
23832383
fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
2384-
fileChooser.setFileFilter(new FileNameExtensionFilter("ZIP files or folders", "zip"));
2384+
fileChooser.setFileFilter(new FileNameExtensionFilter(_("ZIP files or folders"), "zip"));
23852385

23862386
Dimension preferredSize = fileChooser.getPreferredSize();
23872387
fileChooser.setPreferredSize(new Dimension(preferredSize.width + 200, preferredSize.height + 200));
@@ -2404,7 +2404,7 @@ public void handleAddLibrary(Editor editor) {
24042404
zipDeflater.deflate();
24052405
File[] foldersInTmpFolder = tmpFolder.listFiles(new OnlyDirs());
24062406
if (foldersInTmpFolder.length != 1) {
2407-
throw new IOException("Zip doesn't contain one library");
2407+
throw new IOException(_("Zip doesn't contain a library"));
24082408
}
24092409
sourceFile = foldersInTmpFolder[0];
24102410
} catch (IOException e) {
@@ -2413,22 +2413,27 @@ public void handleAddLibrary(Editor editor) {
24132413
}
24142414
}
24152415

2416-
// is there a library?
2417-
File libFolder = scanFatLibrary(sourceFile);
2418-
if (libFolder == null) {
2419-
editor.statusError("Not a valid library");
2416+
// is there a valid library?
2417+
File libFolder = sourceFile;
2418+
String libName = libFolder.getName();
2419+
if (!Sketch.isSanitaryName(libName)) {
2420+
String mess = I18n.format(_("The library \"{0}\" cannot be used.\n"
2421+
+ "Library names must contain only basic letters and numbers.\n"
2422+
+ "(ASCII only and no spaces, and it cannot start with a number)"),
2423+
libName);
2424+
editor.statusError(mess);
24202425
return;
24212426
}
24222427
String[] headerFiles = headerListFromIncludePath(libFolder);
24232428
if (headerFiles == null || headerFiles.length == 0) {
2424-
editor.statusError("Not a valid library");
2429+
editor.statusError(_("Not a valid library: no header files found"));
24252430
return;
24262431
}
24272432

24282433
// copy folder
24292434
File destinationFolder = new File(getSketchbookLibrariesFolder(), sourceFile.getName());
24302435
if (!destinationFolder.mkdir()) {
2431-
editor.statusError("A library named " + sourceFile.getName() + " already exists");
2436+
editor.statusError(I18n.format(_("A library named {0} already exists"), sourceFile.getName()));
24322437
return;
24332438
}
24342439
try {

0 commit comments

Comments
 (0)