Skip to content

Commit

Permalink
devonfw#739: undo changes, updated EnvironmentCommandlet
Browse files Browse the repository at this point in the history
undo changes of previous commit, except getMessageIdeHome()-method, as it is never used
Changed isIdeHomeRequired() in EnvironmentCommandlet from true to false, as this was causing unwanted exceptions
  • Loading branch information
leonrohne27 committed Nov 21, 2024
1 parent cb51b9b commit a08a986
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public String getName() {
@Override
public boolean isIdeHomeRequired() {

return true;
return false;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,11 @@ private String getMessageIdeHomeFound() {
return "IDE environment variables have been set for " + this.ideHome + " in workspace " + this.workspaceName;
}

private String getMessageIdeHomeNotFound() {

return "You are not inside an IDE installation: " + this.cwd;
}

private static String getMessageIdeRootNotFound() {
String root = System.getenv("IDE_ROOT");
if (root == null) {
Expand All @@ -264,7 +269,7 @@ private static String getMessageIdeRootNotFound() {
return "The environment variable IDE_ROOT is pointing to an invalid path " + root + ". Please reinstall IDEasy or manually repair IDE_ROOT variable.";
}
}

/**
* @return {@code true} if this is a test context for JUnits, {@code false} otherwise.
*/
Expand All @@ -278,6 +283,7 @@ protected SystemPath computeSystemPath() {
return new SystemPath(this);
}


private boolean isIdeHome(Path dir) {

if (!Files.isDirectory(dir.resolve("workspaces"))) {
Expand Down Expand Up @@ -803,7 +809,9 @@ private ValidationResult applyAndRun(CliArguments arguments, Commandlet cmd) {
}
if (result.isValid()) {
debug("Running commandlet {}", cmd);
if (cmd.isIdeRootRequired() && (this.ideRoot == null)) {
if (cmd.isIdeHomeRequired() && (this.ideHome == null)) {
throw new CliException(getMessageIdeHomeNotFound(), ProcessResult.NO_IDE_HOME);
} else if (cmd.isIdeRootRequired() && (this.ideRoot == null)) {
throw new CliException(getMessageIdeRootNotFound(), ProcessResult.NO_IDE_ROOT);
}
if (cmd.isProcessableOutput()) {
Expand Down

0 comments on commit a08a986

Please sign in to comment.