Skip to content

Commit

Permalink
devonfw#759: rename
Browse files Browse the repository at this point in the history
  • Loading branch information
leonrohne27 committed Nov 20, 2024
1 parent 50b9fb2 commit 07ae66e
Showing 1 changed file with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.devonfw.tools.ide.commandlet;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;

Expand Down Expand Up @@ -27,7 +29,17 @@ public String getName() {
@Override
public void run() {
Path source = context.getIdeHome();
List<Path> test = context.getFileAccess().listChildrenRecursive(source, path -> path.toString().equals("devon.properties"));
System.out.println(test);
List<Path> test = context.getFileAccess().listChildrenRecursive(source, path -> path.getFileName().toString().equals("devon.properties"));
for (Path file_path : test) {

Path target = file_path.getParent().resolve("ide.properties");

try {
Files.move(file_path, target);
this.context.success("updated file name: " + file_path + "\n-> " + target);
} catch (IOException e) {
this.context.error("Error updating file name: " + file_path);
}
}
}
}

0 comments on commit 07ae66e

Please sign in to comment.