File access relative to current working directory throughout code, make it hard to use code in library
GrumpyBen opened this issue · 1 comments
Throughout the code base, to figure out location of resource files, the following code pattern is used:
f'{"./resources/app" if self.PROD else "."}/some/path'
This creates a dependency on the current working directory, and makes the code harder to reuse outside of xVA-Synth - to package it in a library for example.
As the PROD
attribute is propagated throughout the code base, it could as well be a path prefix, call it ROOT
, instead of a boolean. The code pattern would become simpler and more flexible than current usage:
f'{self.ROOT}/some/path'
Plus dependency on current working directory - which can change due to many factors, e.g. how a Windows shortcut is configured - is removed.
Yeah, this is maybe not the best design. That's a good idea, to use a root path instead of a PROD flag, thank you! Though the flag is I think sometimes used for things other than the path, so I'll possibly add a second variable for this, or something, instead