Fixes #5036 -- Support relative paths for station base dir.

This commit is contained in:
Buster "Silver Eagle" Neece 2022-01-27 02:31:06 -06:00
parent 81636d0b44
commit 2ebba4ac62
No known key found for this signature in database
GPG Key ID: 9FC8B9E008872109
1 changed files with 9 additions and 2 deletions

View File

@ -25,6 +25,7 @@ use OpenApi\Attributes as OA;
use Psr\Http\Message\UriInterface;
use RuntimeException;
use Stringable;
use Symfony\Component\Filesystem\Path;
use Symfony\Component\Serializer\Annotation as Serializer;
use Symfony\Component\Validator\Constraints as Assert;
@ -627,8 +628,14 @@ class Station implements Stringable, IdentifiableEntityInterface
$newDir = $this->truncateNullableString(trim($newDir ?? ''));
if (empty($newDir)) {
$stationsBaseDir = Environment::getInstance()->getStationDirectory();
$newDir = $stationsBaseDir . '/' . $this->getShortName();
$newDir = $this->getShortName();
}
if (Path::isRelative($newDir)) {
$newDir = Path::makeAbsolute(
$newDir,
Environment::getInstance()->getStationDirectory()
);
}
$this->radio_base_dir = $newDir;