Skip to content

Commit

Permalink
Merge pull request #53 from linyimin0812/fix/20230802_fix_FileAlready…
Browse files Browse the repository at this point in the history
…ExistsException_1

fix FileAlreadyExistsException
  • Loading branch information
linyimin0812 authored Aug 2, 2023
2 parents 3664663 + 6fc3a79 commit 4295a46
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,14 @@ private static void acquireNumOfBean(List<BeanInitResult> beanInitResultList) {
}

public static void copyFile(String sourceFilePath, String targetFilePath) throws IOException {
Path sourcePath = Paths.get(sourceFilePath);

Path targetPath = Paths.get(targetFilePath);

// delete target file to avoid FileAlreadyExistsException
Files.deleteIfExists(targetPath);

Path sourcePath = Paths.get(sourceFilePath);

Files.copy(sourcePath, targetPath);
}
}

0 comments on commit 4295a46

Please sign in to comment.