From 07ae66e7a9e8627cdfddc8b383a0e23280e081bd Mon Sep 17 00:00:00 2001 From: leonrohne27 Date: Wed, 20 Nov 2024 13:13:36 +0100 Subject: [PATCH] #759: rename --- .../ide/commandlet/UpdateSettingsCommandlet.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/cli/src/main/java/com/devonfw/tools/ide/commandlet/UpdateSettingsCommandlet.java b/cli/src/main/java/com/devonfw/tools/ide/commandlet/UpdateSettingsCommandlet.java index 1e48d474e..12ffef7f8 100644 --- a/cli/src/main/java/com/devonfw/tools/ide/commandlet/UpdateSettingsCommandlet.java +++ b/cli/src/main/java/com/devonfw/tools/ide/commandlet/UpdateSettingsCommandlet.java @@ -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; @@ -27,7 +29,17 @@ public String getName() { @Override public void run() { Path source = context.getIdeHome(); - List test = context.getFileAccess().listChildrenRecursive(source, path -> path.toString().equals("devon.properties")); - System.out.println(test); + List 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); + } + } } }