Skip to content

Commit

Permalink
devonfw#13: implemented suggested improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
MattesMrzik committed Nov 28, 2023
1 parent 42a008b commit 4e1ba6f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ public Path getPath(String tool) {
*/
public void setPath(String tool, Path path) {

this.paths.add(path);
this.tool2pathMap.put(tool, path);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public void run() {
* Ensures the tool is installed and then runs this tool with the given arguments.
*
* @param toolVersion the explicit version (pattern) to run. Typically {@code null} to ensure the configured version
* is installed and use that one. Otherwise the specified version will be installed in the software repository
* is installed and use that one. Otherwise, the specified version will be installed in the software repository
* without touching and IDE installation and used to run.
* @param args the commandline arguments to run the tool.
*/
Expand Down Expand Up @@ -276,6 +276,7 @@ protected void extract(Path file, Path targetDir) {
}

protected void moveAndProcessExtraction(Path from, Path to) {

this.context.getFileAccess().move(from, to);
}

Expand Down
15 changes: 6 additions & 9 deletions cli/src/main/java/com/devonfw/tools/ide/tool/aws/Aws.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,19 @@ private void makeExecutable(Path file) {
@Override
protected void moveAndProcessExtraction(Path from, Path to) {

if (!this.context.getSystemInfo().isLinux()) {
this.context.getFileAccess().move(from, to);
} else {
if (this.context.getSystemInfo().isLinux()) {
// make binary executable using java nio because unpacking didn't preserve the file permissions
// TODO this can be removed if issue #132 is fixed
Path awsInDistPath = from.resolve("dist").resolve("aws");
Path awsCompleterInDistPath = from.resolve("dist").resolve("aws_completer");

// TODO this can be removed if issue #132 is fixed
makeExecutable(awsInDistPath);
makeExecutable(awsCompleterInDistPath);

// running the install-script that aws shipped
ProcessContext pc = this.context.newProcess();
Path linuxInstallScript = from.resolve("install");
pc.executable("bash");
pc.addArgs(linuxInstallScript, "-i", from.toString(), "-b", from.toString());
pc.executable(linuxInstallScript);
pc.addArgs("-i", from.toString(), "-b", from.toString());
pc.run();

// the install-script that aws ships creates symbolic links to binaries but using absolute paths
Expand All @@ -74,9 +72,8 @@ protected void moveAndProcessExtraction(Path from, Path to) {
}
this.context.getFileAccess().delete(linuxInstallScript);
this.context.getFileAccess().delete(from.resolve("dist"));

this.context.getFileAccess().move(from, to);
}
super.moveAndProcessExtraction(from, to);
}

@Override
Expand Down

0 comments on commit 4e1ba6f

Please sign in to comment.