Skip to content

Commit

Permalink
Merge pull request #42682 from azinneera/cleanCmd
Browse files Browse the repository at this point in the history
Remove unnecessary clean command message
  • Loading branch information
azinneera authored May 6, 2024
2 parents 769e28e + 0267416 commit 174b221
Showing 1 changed file with 19 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,20 @@ public void execute() {
return;
}

if (this.targetDir == null) {
if (this.targetDir != null) {
if (Files.notExists(this.targetDir)) {
CommandUtil.printError(this.outStream,
"provided target directory '" + this.targetDir + "' does not exist.",
null, false);
} else if (!Files.isDirectory(this.targetDir)) {
CommandUtil.printError(this.outStream,
"provided target path '" + this.targetDir + "' is not a directory.",
null, false);
} else {
ProjectUtils.deleteDirectory(this.targetDir);
this.outStream.println("Successfully deleted '" + this.targetDir + "'.");
}
} else {
try {
Project project = BuildProject.load(this.projectPath);
this.targetDir = project.targetDir();
Expand All @@ -86,23 +99,13 @@ public void execute() {
CommandUtil.exitError(this.exitWhenFinish);
return;
}
if (Files.exists(this.targetDir)) {
ProjectUtils.deleteDirectory(this.targetDir);
this.outStream.println("Successfully deleted '" + this.targetDir + "'.");
}
}

// Delete the target directory
if (Files.notExists(this.targetDir)) {
CommandUtil.printError(this.outStream,
"provided target directory '" + this.targetDir + "' does not exist.",
null, false);
} else if (!Files.isDirectory(this.targetDir)) {
CommandUtil.printError(this.outStream,
"provided target path '" + this.targetDir + "' is not a directory.",
null, false);
} else {
ProjectUtils.deleteDirectory(this.targetDir);
this.outStream.println("Successfully deleted '" + this.targetDir + "'.");
}

//delete the generated directory
// delete the generated directory
Path generatedDir;
try {
Project project = BuildProject.load(this.projectPath);
Expand Down

0 comments on commit 174b221

Please sign in to comment.