diff --git a/src/main/java/com/docus/sw/fenpan/FenpanService.java b/src/main/java/com/docus/sw/fenpan/FenpanService.java index 2b5d472..aa6d6fe 100644 --- a/src/main/java/com/docus/sw/fenpan/FenpanService.java +++ b/src/main/java/com/docus/sw/fenpan/FenpanService.java @@ -114,6 +114,12 @@ public class FenpanService { File[] files = sourceFile.listFiles(); for (File file : files) { //非图片模式,跳过。 + if(!(file.getName().endsWith(".jpg") || file.getName().endsWith(".png") + || file.getName().endsWith(".jpeg") || file.getName().endsWith(".tif") + || file.getName().endsWith(".tiff"))){ + continue; + } + try { ImageInfo imageInfo = Imaging.getImageInfo(file); int height = imageInfo.getHeight(); @@ -188,9 +194,9 @@ public class FenpanService { Pieces pieces = new Pieces(FileTypeEnum.JPG, o.getParentFile().getAbsolutePath(), o.getParentFile().getName()); allDirectory.add(pieces); } else { - FileUtils.delete(new File(o.getAbsolutePath())); + System.out.println("请删除无效的文件:" + o.getAbsolutePath()); - throw new RuntimeException("请删除无效的文件:" + o.getAbsolutePath()); + } break; } diff --git a/src/main/java/com/docus/sw/fenpan/MyApplication.java b/src/main/java/com/docus/sw/fenpan/MyApplication.java index a3522c3..d6124d3 100644 --- a/src/main/java/com/docus/sw/fenpan/MyApplication.java +++ b/src/main/java/com/docus/sw/fenpan/MyApplication.java @@ -182,7 +182,7 @@ public class MyApplication { int returnValue = fileChooser.showOpenDialog(null); if (returnValue == JFileChooser.APPROVE_OPTION) { File selectedFile = fileChooser.getSelectedFile(); - savePathField.setText(selectedFile.getAbsolutePath()); + savePathField.setText(selectedFile.getAbsolutePath()+"/"); } } });