|
|
@ -127,7 +127,7 @@ public class FileOperationHelper { |
|
|
|
WARNING_MESSAGE); |
|
|
|
WARNING_MESSAGE); |
|
|
|
return StringUtils.EMPTY; |
|
|
|
return StringUtils.EMPTY; |
|
|
|
} |
|
|
|
} |
|
|
|
String name = getNoRepeatedName4Paste(targetDir, sourceFile.getName()); |
|
|
|
String name = getNoRepeatedName4Paste(targetDir, sourceFile); |
|
|
|
String targetFile = StableUtils.pathJoin(targetDir, name); |
|
|
|
String targetFile = StableUtils.pathJoin(targetDir, name); |
|
|
|
if (sourceFile.isDirectory()) { |
|
|
|
if (sourceFile.isDirectory()) { |
|
|
|
copyDir(sourcePath, targetFile, withCopyVcs); |
|
|
|
copyDir(sourcePath, targetFile, withCopyVcs); |
|
|
@ -177,19 +177,22 @@ public class FileOperationHelper { |
|
|
|
* 重名处理 |
|
|
|
* 重名处理 |
|
|
|
* |
|
|
|
* |
|
|
|
* @param targetDir |
|
|
|
* @param targetDir |
|
|
|
* @param oldName |
|
|
|
* @param sourceFile |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private String getNoRepeatedName4Paste(String targetDir, String oldName) { |
|
|
|
private String getNoRepeatedName4Paste(String targetDir, FileNode sourceFile) { |
|
|
|
|
|
|
|
String oldName = sourceFile.getName(); |
|
|
|
while (isNameRepeaded(targetDir, oldName)) { |
|
|
|
while (isNameRepeaded(targetDir, oldName)) { |
|
|
|
|
|
|
|
if (sourceFile.isDirectory()) { |
|
|
|
|
|
|
|
//目录重名
|
|
|
|
|
|
|
|
oldName = oldName + Toolkit.i18nText("Fine-Design_Table_Data_Copy_Of_Table_Data"); |
|
|
|
|
|
|
|
} else { |
|
|
|
int index = oldName.lastIndexOf("."); |
|
|
|
int index = oldName.lastIndexOf("."); |
|
|
|
if (index > 0) { |
|
|
|
if (index > 0) { |
|
|
|
String oName = oldName.substring(0, index); |
|
|
|
String oName = oldName.substring(0, index); |
|
|
|
oName = oName + Toolkit.i18nText("Fine-Design_Table_Data_Copy_Of_Table_Data"); |
|
|
|
oName = oName + Toolkit.i18nText("Fine-Design_Table_Data_Copy_Of_Table_Data"); |
|
|
|
oldName = oName.concat(oldName.substring(index)); |
|
|
|
oldName = oName.concat(oldName.substring(index)); |
|
|
|
} else { |
|
|
|
} |
|
|
|
//目录重名
|
|
|
|
|
|
|
|
oldName = oldName + Toolkit.i18nText("Fine-Design_Table_Data_Copy_Of_Table_Data"); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return oldName; |
|
|
|
return oldName; |
|
|
|