Add customizable data home path (#2871)

* Add customizable data home path

* Add TTS_HOME as an option
This commit is contained in:
Julian Weber 2023-08-14 21:02:48 +02:00 committed by GitHub
parent c4e5effab9
commit febcaf710a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -126,7 +126,13 @@ def get_import_path(obj: object) -> str:
def get_user_data_dir(appname):
if sys.platform == "win32":
TTS_HOME = os.environ.get("TTS_HOME")
XDG_DATA_HOME = os.environ.get("XDG_DATA_HOME")
if TTS_HOME is not None:
ans = Path(TTS_HOME).expanduser().resolve(strict=False)
elif XDG_DATA_HOME is not None:
ans = Path(XDG_DATA_HOME).expanduser().resolve(strict=False)
elif sys.platform == "win32":
import winreg # pylint: disable=import-outside-toplevel
key = winreg.OpenKey(