Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove output directory creation from render.php #119

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading