Skip to content

Commit

Permalink
Remove output directory creation from render.php
Browse files Browse the repository at this point in the history
  • Loading branch information
haszi committed Apr 26, 2024
1 parent f93552a commit f663516
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
10 changes: 8 additions & 2 deletions phpdotnet/phd/Options/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,14 @@ public function option_output(string $k, mixed $v): array
if (is_array($v)) {
trigger_error("Only a single output location can be supplied", E_USER_ERROR);
}
if (!is_dir($v)) {
mkdir($v, 0777, true);
if (!file_exists($v)) {
v("Creating output directory..", VERBOSE_MESSAGES);
if (!mkdir($v, 0777, true)) {
v("Can't create output directory : %s", $v, E_USER_ERROR);
}
v("Output directory created", VERBOSE_MESSAGES);
} elseif (!is_dir($v)) {
v("Output directory is a file?", E_USER_ERROR);
}
if (!is_dir($v) || !is_readable($v)) {
trigger_error(sprintf("'%s' is not a valid directory", $v), E_USER_ERROR);
Expand Down
7 changes: 1 addition & 6 deletions render.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,7 @@
trigger_error("No Docbook file given. Specify it on the command line with --docbook.", E_USER_ERROR);
}
if (!file_exists(Config::output_dir())) {
v("Creating output directory..", VERBOSE_MESSAGES);
if (!mkdir(Config::output_dir(), 0777, True)) {
v("Can't create output directory : %s", Config::output_dir(), E_USER_ERROR);
}
} elseif (!is_dir(Config::output_dir())) {
v("Output directory is not a file?", E_USER_ERROR);
v("Output directory doesn't exist", E_USER_ERROR);
}

// This needs to be moved. Preferably into the PHP package.
Expand Down

0 comments on commit f663516

Please sign in to comment.