Skip to content

Commit 26a233c

Browse files
committed
only evaluate writability of parent dir
1 parent c424a24 commit 26a233c

File tree

1 file changed

+1
-9
lines changed
  • framework/codemodder-base/src/main/java/io/codemodder

1 file changed

+1
-9
lines changed

framework/codemodder-base/src/main/java/io/codemodder/CLI.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -282,18 +282,10 @@ public Integer call() throws IOException {
282282
Path outputPath = null;
283283
if (output != null) {
284284
outputPath = output.getAbsoluteFile().toPath();
285-
if(!Files.exists(outputPath)) {
286-
Files.createFile(outputPath);
287-
}
288285

289286
// check if the output file parent directory doesn't exist or isn't writable
290287
if (!Files.exists(outputPath.getParent()) || !Files.isWritable(outputPath.getParent())) {
291-
log.error("The output file parent directory doesn't exist");
292-
return ERROR_CANT_WRITE_OUTPUT_FILE;
293-
}
294-
295-
if (!Files.isWritable(outputPath)) {
296-
log.error("The output file is not writable");
288+
log.error("The output file parent directory doesn't exist or isn't writable");
297289
return ERROR_CANT_WRITE_OUTPUT_FILE;
298290
}
299291
}

0 commit comments

Comments
 (0)