mirror of
https://git.srhtnin.garden/sarah/SaraSort.git
synced 2026-10-14 10:48:11 +02:00
Windows support
This commit is contained in:
1 parent
f1935a119b
commit
6cb2bd74cc
13 files changed
+207
-25
No files matched your search
@@ -19,9 +19,17 @@ AppName = "SaraSort"
|
||||
BundledFontFamily = "Fixedsys Excelsior"
|
||||
ActiveFontFamily = BundledFontFamily # set by ApplyAppearance, read by BuildTheme
|
||||
|
||||
IsWindows = sys.platform == "win32"
|
||||
|
||||
# Each system's own per-user folders, like SaraSuite's: ~/.config and
|
||||
# ~/.local/share on Linux, %APPDATA% and %LOCALAPPDATA% on Windows.
|
||||
Home = Path.home()
|
||||
ConfigHome = Home / ".config"
|
||||
DataHome = Home / ".local" / "share"
|
||||
if IsWindows:
|
||||
ConfigHome = Path(os.environ.get("APPDATA") or Home / "AppData" / "Roaming")
|
||||
DataHome = Path(os.environ.get("LOCALAPPDATA") or Home / "AppData" / "Local")
|
||||
else:
|
||||
ConfigHome = Path(os.environ.get("XDG_CONFIG_HOME") or Home / ".config")
|
||||
DataHome = Path(os.environ.get("XDG_DATA_HOME") or Home / ".local" / "share")
|
||||
|
||||
SharedConfigDir = ConfigHome / "SaraSuite"
|
||||
ThemesDir = SharedConfigDir / "Themes"
|
||||
@@ -100,10 +108,13 @@ class AppConfig:
|
||||
HideWindowTitleBar: bool = False
|
||||
# Where SaraSuite installs SaraSortd: GlobalConf.toml and the two
|
||||
# directory config templates live in SortdConfigDir, SaraSortd.py in
|
||||
# SortdAppDir, and it runs as a systemd user unit.
|
||||
SortdConfigDir: str = "~/.config/SaraSuite/SaraSortd"
|
||||
SortdAppDir: str = "~/.local/share/SaraSuite/Programs/SaraSortd/App"
|
||||
ServiceName: str = "SaraSortd.service"
|
||||
# SortdAppDir, and it runs as a systemd user unit (Linux) or a background
|
||||
# service started from the Startup folder (Windows; see Service.py).
|
||||
SortdConfigDir: str = (str(ConfigHome / "SaraSuite" / "SaraSortd") if IsWindows
|
||||
else "~/.config/SaraSuite/SaraSortd")
|
||||
SortdAppDir: str = (str(DataHome / "SaraSuite" / "Programs" / "SaraSortd" / "App") if IsWindows
|
||||
else "~/.local/share/SaraSuite/Programs/SaraSortd/App")
|
||||
ServiceName: str = "SaraSortd" if IsWindows else "SaraSortd.service"
|
||||
# SaraSortd only reads GlobalConf.toml when it starts.
|
||||
AutoRestart: bool = True
|
||||
RefreshSeconds: int = 5 # status and log refresh on the Service page
|
||||
@@ -238,6 +249,8 @@ def ChildEnvironment() -> dict[str, str]:
|
||||
Environment.pop("LD_LIBRARY_PATH", None)
|
||||
for Key in ("PYTHONHOME", "PYTHONPATH"):
|
||||
Environment.pop(Key, None)
|
||||
if IsWindows:
|
||||
Environment["PYTHONUTF8"] = "1" # every Sara program reads and writes UTF-8
|
||||
return Environment
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user