Respect the WSL desktop data directory

This commit is contained in:
gloamxun committed 2026-12-02 10:20:46 +08:00
1 parent fbc339f5c4
commit 77f6ace5e0
2 files changed
+9 -5

No files matched your search

+4 -3
View File
@@ -8,9 +8,10 @@ Windows 当前默认的 WSL 发行版。配置多个发行版时可用 TEXRRA_WS
安装后从开始菜单打开 Texrra。也可以解压便携包,运行同目录的 安装后从开始菜单打开 Texrra。也可以解压便携包,运行同目录的
Texrra 桌面程序。在项目库导入包含主 .tex 文件的 ZIP,打开项目后编辑 Texrra 桌面程序。在项目库导入包含主 .tex 文件的 ZIP,打开项目后编辑
正文或公式,等待预览更新并下载 PDF。桌面项目保存在 Fedora 用户目录的 正文或公式,等待预览更新并下载 PDF。桌面项目默认保存在 WSL 用户目录的
.local/share/texrra-desktop/projects。窗口关闭时,桌面端停止自己启动的 .local/share/texrra-desktop/projects。设置绝对 XDG_DATA_HOME 路径时,
后台引擎。 项目存放在该目录下的 texrra-desktop/projects。窗口关闭时,桌面端停止
自己启动的后台引擎。
## 构建 ## 构建
+5 -2
View File
@@ -125,7 +125,10 @@ def prepare(args, repo):
def private_home(): def private_home():
return Path.home() / ".local/share/texrra-desktop" data = Path(os.environ.get("XDG_DATA_HOME", ""))
if not data.is_absolute():
data = Path.home() / ".local/share"
return data / "texrra-desktop"
def install(package, home): def install(package, home):
@@ -174,7 +177,7 @@ def launch(args):
try: try:
fcntl.flock(lock, fcntl.LOCK_EX | fcntl.LOCK_NB) fcntl.flock(lock, fcntl.LOCK_EX | fcntl.LOCK_NB)
except BlockingIOError as error: except BlockingIOError as error:
raise ValueError("The Texrra desktop backend is already running in this Fedora account") from error raise ValueError("The Texrra desktop backend is already running for this WSL data directory") from error
for name in ("projects", "state"): for name in ("projects", "state"):
(home / name).mkdir(mode=0o700, exist_ok=True) (home / name).mkdir(mode=0o700, exist_ok=True)
bundle = install(Path(__file__).resolve().parent, home) bundle = install(Path(__file__).resolve().parent, home)