-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: ensure scenario dir exists. partial change to pathlib
- Loading branch information
Showing
4 changed files
with
23 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,47 @@ | ||
import os.path as osp | ||
from dataclasses import dataclass | ||
from typing import Optional | ||
from pathlib import Path | ||
|
||
|
||
@dataclass | ||
class Directories: | ||
cache_dir: str = "cache" | ||
resource_dir: str = osp.join("doom_creator", "resources") # noqa: RUF009 as this is not really a dynamical call | ||
scenario_out_dir: Optional[str] = None | ||
build_dir: Optional[str] = None | ||
textures_dir: Optional[str] = None | ||
assets_dir: Optional[str] = None | ||
scenario_yaml_dir: Optional[str] = None | ||
dataset_dir: Optional[str] = None | ||
cache_dir: Path = "cache" | ||
resource_dir: Path = Path("doom_creator", "resources") | ||
scenario_out_dir: Optional[Path] = None | ||
build_dir: Optional[Path] = None | ||
textures_dir: Optional[Path] = None | ||
assets_dir: Optional[Path] = None | ||
scenario_yaml_dir: Optional[Path] = None | ||
dataset_dir: Optional[Path] = None | ||
|
||
def __post_init__(self): | ||
self.CACHE_DIR = self.cache_dir | ||
self.SCENARIO_OUT_DIR = ( | ||
osp.join(self.CACHE_DIR, "scenarios") | ||
self.CACHE_DIR: Path = self.cache_dir | ||
self.SCENARIO_OUT_DIR: Path = ( | ||
Path(self.CACHE_DIR, "scenarios") | ||
if self.scenario_out_dir is None | ||
else self.scenario_out_dir | ||
) | ||
self.BUILD_DIR = ( | ||
osp.join(self.SCENARIO_OUT_DIR, "build") | ||
self.BUILD_DIR: Path = ( | ||
Path(self.SCENARIO_OUT_DIR, "build") | ||
if self.build_dir is None | ||
else self.build_dir | ||
) | ||
self.TEXTURES_DIR = ( | ||
osp.join(self.CACHE_DIR, "textures") | ||
self.TEXTURES_DIR: Path = ( | ||
Path(self.CACHE_DIR, "textures") | ||
if self.textures_dir is None | ||
else self.textures_dir | ||
) | ||
self.RESOURCE_DIR = self.resource_dir | ||
self.ASSETS_DIR = ( | ||
osp.join(self.RESOURCE_DIR, "assets") | ||
self.RESOURCE_DIR: Path = self.resource_dir | ||
self.ASSETS_DIR: Path = ( | ||
Path(self.RESOURCE_DIR, "assets") | ||
if self.assets_dir is None | ||
else self.assets_dir | ||
) | ||
self.SCENARIO_YAML_DIR = ( | ||
osp.join(self.RESOURCE_DIR, "config") | ||
self.SCENARIO_YAML_DIR: Path = ( | ||
Path(self.RESOURCE_DIR, "config") | ||
if self.scenario_yaml_dir is None | ||
else self.scenario_yaml_dir | ||
) | ||
self.DATASET_DIR = ( | ||
self.DATASET_DIR: Path = ( | ||
self.TEXTURES_DIR if self.dataset_dir is None else self.dataset_dir | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.