Skip to content

Commit

Permalink
devonfw#440: fixed tests for linux and windows
Browse files Browse the repository at this point in the history
removed thrown exception from makeExecutable
  • Loading branch information
jan-vcapgemini committed Sep 5, 2024
1 parent 4e2f009 commit d2cc46c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
4 changes: 1 addition & 3 deletions cli/src/main/java/com/devonfw/tools/ide/io/FileAccess.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.devonfw.tools.ide.io;

import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.attribute.PosixFilePermission;
import java.util.List;
Expand Down Expand Up @@ -247,7 +246,6 @@ default void extract(Path archiveFile, Path targetDir, Consumer<Path> postExtrac
* Makes a file executable. Equivalent of using 'chmod a+x'. Adds execute permissions to current file permissions.
*
* @param filePath Path to the file.
* @throws IOException if an I/O error occurs.
*/
void makeExecutable(Path filePath) throws IOException;
void makeExecutable(Path filePath);
}
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,7 @@ public boolean isEmptyDir(Path dir) {
}

@Override
public void makeExecutable(Path filePath) throws IOException {
public void makeExecutable(Path filePath) {
if (SystemInfoImpl.INSTANCE.isWindows()) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ private void createStartupCommandScript() {
bashFile = Files.createFile(getToolBinPath().resolve(getName()));
MacOsHelper macOsHelper = new MacOsHelper(context);
Path appPath = macOsHelper.findAppDir(macOsHelper.findRootToolPath(this, context));
this.context.getFileAccess().makeExecutable(getToolPath().resolve(appPath).resolve(IdeContext.FOLDER_CONTENTS).resolve("MacOS").resolve(IDEA));
Files.writeString(bashFile,
bashFileContentStart + getToolPath().resolve(appPath).resolve(IdeContext.FOLDER_CONTENTS).resolve("MacOS").resolve(IDEA) + bashFileContentEnd);
} catch (IOException e) {
Expand All @@ -81,6 +82,7 @@ private void createStartupCommandScript() {
} else if (this.context.getSystemInfo().isWindows()) {
try {
bashFile = Files.createFile(getToolBinPath().resolve(getName()));
this.context.getFileAccess().makeExecutable(getToolBinPath().resolve(IDEA64_EXE));
Files.writeString(bashFile,
bashFileContentStart + getToolBinPath().resolve(IDEA64_EXE) + bashFileContentEnd);
} catch (IOException e) {
Expand All @@ -89,18 +91,15 @@ private void createStartupCommandScript() {
} else {
try {
bashFile = Files.createFile(getToolBinPath().resolve(getName()));
this.context.getFileAccess().makeExecutable(getToolBinPath().resolve(IDEA_BASH_SCRIPT));
Files.writeString(bashFile,
bashFileContentStart + getToolBinPath().resolve(IDEA_BASH_SCRIPT) + bashFileContentEnd);
} catch (IOException e) {
throw new RuntimeException(e);
}
}

try {
context.getFileAccess().makeExecutable(bashFile);
} catch (IOException e) {
throw new RuntimeException(e);
}
context.getFileAccess().makeExecutable(bashFile);
}

}

0 comments on commit d2cc46c

Please sign in to comment.