Skip to content

Commit a7d686c

Browse files
devonfw#103: implemented requested changes
renamed retrievePath to getPath renamed addPath to setPath
1 parent 097bbdc commit a7d686c

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

cli/src/main/java/com/devonfw/tools/ide/common/SystemPath.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ public SystemPath(String envPath, Path softwarePath, char pathSeparator, IdeCont
6767
} else {
6868
Path duplicate = this.tool2pathMap.putIfAbsent(tool, path);
6969
if (duplicate != null) {
70-
context.warning("Duplicated tool path for tool: {} at path: {} with duplicated path: {}.", tool, path, duplicate);
70+
context.warning("Duplicated tool path for tool: {} at path: {} with duplicated path: {}.", tool, path,
71+
duplicate);
7172
}
7273
}
7374
}
@@ -160,16 +161,16 @@ public Path findBinary(Path toolPath) {
160161
* @return the {@link Path} to the directory of the tool where the binaries can be found or {@code null} if the tool
161162
* is not installed.
162163
*/
163-
public Path retrievePath(String tool) {
164+
public Path getPath(String tool) {
164165

165166
return this.tool2pathMap.get(tool);
166167
}
167168

168169
/**
169170
* @param tool the name of the tool.
170-
* @param path the new {@link #retrievePath(String) tool bin path}.
171+
* @param path the new {@link #getPath(String) tool bin path}.
171172
*/
172-
public void addPath(String tool, Path path) {
173+
public void setPath(String tool, Path path) {
173174

174175
this.tool2pathMap.put(tool, path);
175176
}

cli/src/main/java/com/devonfw/tools/ide/tool/LocalToolCommandlet.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ protected boolean doInstall(boolean silent) {
8181
fileAccess.backup(toolPath);
8282
}
8383
fileAccess.symlink(installation.linkDir(), toolPath);
84-
this.context.getPath().addPath(this.tool, installation.binDir());
84+
this.context.getPath().setPath(this.tool, installation.binDir());
8585
if (installedVersion == null) {
8686
this.context.success("Successfully installed {} in version {}", this.tool, resolvedVersion);
8787
} else {

cli/src/test/java/com/devonfw/tools/ide/context/IdeContextTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ public void testBasicProjectEnvironment() {
4646
assertThat(systemPath.toString()).isNotEqualTo(envPath).endsWith(envPath);
4747
Path softwarePath = context.getSoftwarePath();
4848
Path javaBin = softwarePath.resolve("java/bin");
49-
assertThat(systemPath.retrievePath("java")).isEqualTo(javaBin);
49+
assertThat(systemPath.getPath("java")).isEqualTo(javaBin);
5050
Path mvnBin = softwarePath.resolve("mvn/bin");
51-
assertThat(systemPath.retrievePath("mvn")).isEqualTo(mvnBin);
51+
assertThat(systemPath.getPath("mvn")).isEqualTo(mvnBin);
5252
assertThat(systemPath.toString()).contains(javaBin.toString(), mvnBin.toString());
5353
assertThat(variables.getType()).isSameAs(EnvironmentVariablesType.RESOLVED);
5454
assertThat(variables.getByType(EnvironmentVariablesType.RESOLVED)).isSameAs(variables);

0 commit comments

Comments
 (0)