Skip to content

Commit edfda62

Browse files
authored
Checking file extension must be done after checking parent directory existence. (#16)
1 parent c9fb467 commit edfda62

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/VisualizerTask.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -324,18 +324,18 @@ protected function resolveDestination(string $buildfilePath, string $format, ?st
324324
$destination .= DIRECTORY_SEPARATOR . $buildfileInfo['filename'] . '.' . $format;
325325
}
326326

327-
// Adding right extension if necessary
328-
if (!StringHelper::endsWith(".$format", $destination)) {
329-
$destination .= ".$format";
330-
}
331-
332327
// Parent directory must exist
333328
if (!is_dir(dirname($destination))) {
334329
$exceptionMessage = "Directory '$destination' is invalid";
335330
$this->log($exceptionMessage, Project::MSG_ERR);
336331
throw new BuildException(sprintf($exceptionMessage, $destination));
337332
}
338333

334+
// Adding right extension if necessary
335+
if (!StringHelper::endsWith(".$format", $destination)) {
336+
$destination .= ".$format";
337+
}
338+
339339
return $destination;
340340
}
341341

0 commit comments

Comments
 (0)