session-sync: project.worktree 路径转 WSL(修Session location unavailable);model-sync 已补 db-exec/tui.json
This commit is contained in:
@@ -39,6 +39,13 @@ DISTRO = "Ubuntu-24.04"
|
||||
BUDGET = 150
|
||||
# 同步的表(WSL 侧缺表/缺列自动跳过)
|
||||
TABLES = ["project", "session", "session_v2", "session_message", "part"]
|
||||
# ★ project.worktree 路径转换(Win 绝对路径 -> WSL 绝对路径)
|
||||
# Win 侧 session 的 project.worktree = C:/Users/ypshidifu/... (OC 启动 cwd)
|
||||
# 推给 WSL 后原样是 Win 路径 → WSL 侧 session 面板提示
|
||||
# 「Session location unavailable / C:/Users/ypshidifu / Choose another directory」。
|
||||
# 必须把 C:/Users/ypshidifu 前缀转成 WSL 的 /root。
|
||||
_WIN_HOME_PREFIX_SL = "C:/Users/ypshidifu"
|
||||
_WSL_HOME_PREFIX = "/root"
|
||||
|
||||
|
||||
def log(m):
|
||||
@@ -288,6 +295,16 @@ def main():
|
||||
list(targets),
|
||||
)
|
||||
]
|
||||
# ★ project.worktree 路径转换(Win C:/Users/ypshidifu/... -> WSL /root/...)
|
||||
# 修 WSL 侧「Session location unavailable / C:/Users/ypshidifu」
|
||||
if tables.get("project"):
|
||||
_wkcol = "worktree"
|
||||
for _pr in tables["project"]:
|
||||
_wk = _pr.get(_wkcol)
|
||||
if isinstance(_wk, str) and _wk.startswith(_WIN_HOME_PREFIX_SL):
|
||||
_pr[_wkcol] = _WSL_HOME_PREFIX + _wk[len(_WIN_HOME_PREFIX_SL):]
|
||||
elif isinstance(_wk, str) and _wk.startswith("C:\\Users\\ypshidifu"):
|
||||
_pr[_wkcol] = _WSL_HOME_PREFIX + _wk.replace("C:\\Users\\ypshidifu", "")
|
||||
try:
|
||||
tables["session_v2"] = [
|
||||
dict(r)
|
||||
|
||||
Reference in New Issue
Block a user