Skip to content
This repository has been archived by the owner on Dec 28, 2023. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
4ra1n committed Mar 13, 2023
1 parent bef30a1 commit a5705e6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/main/java/com/chaitin/xray/utils/XrayUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,14 @@ public static void rmAllConfig(String targetDir) {
try {
Path thisPath = Paths.get(Const.ConfigYaml);
Path xrayPath = Paths.get(targetDir + Const.ConfigYaml);
// 保留
Path backPath = Paths.get(xrayPath + ".bak");
if (!Files.exists(backPath)) {
Files.write(backPath, Files.readAllBytes(xrayPath));
}
// do not delete current config.yaml
if (!thisPath.toFile().getAbsolutePath().equals(
xrayPath.toFile().getAbsolutePath())) {
// 保留
Path backPath = Paths.get(xrayPath + Const.ConfigYaml + ".bak");
Files.write(backPath, Files.readAllBytes(xrayPath));
Files.delete(xrayPath);
}
} catch (Exception ignored) {
Expand Down

0 comments on commit a5705e6

Please sign in to comment.