CropAssetCopyTool
This commit is contained in:
@@ -155,14 +155,14 @@ public class CropAssetCopyTool {
|
||||
if (targetFile.exists()) {
|
||||
while (targetFile.exists()) {
|
||||
String oldName = FilenameUtils.removeExtension(targetFile.getName());
|
||||
String newName = oldName + "--002." + FilenameUtils.getExtension(oldName);
|
||||
String extension = FilenameUtils.getExtension(targetFile.getName());
|
||||
String newName = oldName + "--002." + extension;
|
||||
if (oldName.length() > 5 && oldName.charAt(oldName.length() - 4) == '-'
|
||||
&& oldName.charAt(oldName.length() - 3) == '-'
|
||||
&& StringUtils.isNumeric(oldName.substring(oldName.length() - 3))) {
|
||||
int num = Integer.parseInt(oldName.substring(oldName.length() - 3));
|
||||
num++;
|
||||
newName = oldName.substring(0, oldName.length() - 3) + String.format("%03d", num) + "."
|
||||
+ FilenameUtils.getExtension(targetFile.getName());
|
||||
newName = oldName.substring(0, oldName.length() - 3) + String.format("%03d", num) + "." + extension;
|
||||
}
|
||||
targetFile = new File(targetDir + "\\" + newName);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user