Skip to content

Commit

Permalink
better error message when library names clash
Browse files Browse the repository at this point in the history
filter out non .ZIP files
  • Loading branch information
ffissore authored and cmaglie committed May 11, 2013
1 parent 3d5c76a commit 8266ac5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/src/processing/app/Base.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import java.util.*;

import javax.swing.*;
import javax.swing.filechooser.FileNameExtensionFilter;

import processing.app.debug.Compiler;
import processing.app.debug.Target;
Expand Down Expand Up @@ -2380,6 +2381,7 @@ public void handleAddLibrary(Editor editor) {
JFileChooser fileChooser = new JFileChooser(System.getProperty("user.home"));
fileChooser.setDialogTitle(_("Select a zip file or a folder containing the library you'd like to add"));
fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
fileChooser.setFileFilter(new FileNameExtensionFilter("ZIP files or folders", "zip"));

Dimension preferredSize = fileChooser.getPreferredSize();
fileChooser.setPreferredSize(new Dimension(preferredSize.width + 200, preferredSize.height + 200));
Expand Down Expand Up @@ -2426,7 +2428,7 @@ public void handleAddLibrary(Editor editor) {
// copy folder
File destinationFolder = new File(getSketchbookLibrariesFolder(), sourceFile.getName());
if (!destinationFolder.mkdir()) {
editor.statusError("Can't create folder: " + sourceFile.getName() + " into libraries folder");
editor.statusError("A library named " + sourceFile.getName() + " already exists");
return;
}
try {
Expand Down

0 comments on commit 8266ac5

Please sign in to comment.