Current API for file generation (elasticai.creator.file_generation.on_disk_path.Path) was introduced such that objects receiving a Path could decide on their own, whether that is supposed to represent a file or a directory, while at the same time not being able to change or inspect the base name.
However this turns out to be rather complicated and not intuitive at all. Therefore I suggest we stick to a more traditional model for this and do something like
class Directory(Protocol):
def make_subdirectory(self, name) -> "Directory": ...
def make_file(self, name) -> "File": ...
class File(Protocol):
def write(template: Template): ...
In case a hardware module consists of a single file I don't think it's too bad to just write it to something like build/my_single_file_module/my_single_file_module.vhd instead of build/my_single_file_module.vhd
Current API for file generation (
elasticai.creator.file_generation.on_disk_path.Path
) was introduced such that objects receiving aPath
could decide on their own, whether that is supposed to represent a file or a directory, while at the same time not being able to change or inspect the base name.However this turns out to be rather complicated and not intuitive at all. Therefore I suggest we stick to a more traditional model for this and do something like
In case a hardware module consists of a single file I don't think it's too bad to just write it to something like
build/my_single_file_module/my_single_file_module.vhd
instead ofbuild/my_single_file_module.vhd