Add home path getter to config
This commit is contained in:
@@ -390,6 +390,10 @@ class Config:
|
||||
"""Un-scale fixed gui sizes by the screen scale factor."""
|
||||
return int(value/self.guiScale)
|
||||
|
||||
def homePath(self) -> Path:
|
||||
"""The user's home folder."""
|
||||
return self._homePath
|
||||
|
||||
def dataPath(self, target: str | None = None) -> Path:
|
||||
"""Return a path in the data folder."""
|
||||
if isinstance(target, str):
|
||||
|
||||
@@ -200,6 +200,9 @@ def testBaseConfig_Methods(fncPath):
|
||||
tstConf = Config()
|
||||
tstConf.initConfig(confPath=fncPath, dataPath=fncPath)
|
||||
|
||||
# Home Path
|
||||
assert tstConf.homePath() == Path.home().absolute()
|
||||
|
||||
# Data Path
|
||||
assert tstConf.dataPath() == fncPath
|
||||
assert tstConf.dataPath("stuff") == fncPath / "stuff"
|
||||
|
||||
Reference in New Issue
Block a user