Skip to content

Commit 709cb34

Browse files
committed
devonfw#759: check
1 parent 07ae66e commit 709cb34

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

cli/src/main/java/com/devonfw/tools/ide/commandlet/UpdateSettingsCommandlet.java

+10-7
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,16 @@ public void run() {
3232
List<Path> test = context.getFileAccess().listChildrenRecursive(source, path -> path.getFileName().toString().equals("devon.properties"));
3333
for (Path file_path : test) {
3434

35-
Path target = file_path.getParent().resolve("ide.properties");
36-
37-
try {
38-
Files.move(file_path, target);
39-
this.context.success("updated file name: " + file_path + "\n-> " + target);
40-
} catch (IOException e) {
41-
this.context.error("Error updating file name: " + file_path);
35+
if (context.getFileAccess().findFirst(file_path.getParent(), path -> path.getFileName().toString().equals("ide.properties"), false) != null) {
36+
37+
} else {
38+
Path target = file_path.getParent().resolve("ide.properties");
39+
try {
40+
Files.move(file_path, target);
41+
this.context.success("updated file name: " + file_path + "\n-> " + target);
42+
} catch (IOException e) {
43+
this.context.error("Error updating file name: " + file_path);
44+
}
4245
}
4346
}
4447
}

0 commit comments

Comments
 (0)