diff --git a/src/Conclave.App/Sessions/Database.cs b/src/Conclave.App/Sessions/Database.cs index 6afa4e3..ea28569 100644 --- a/src/Conclave.App/Sessions/Database.cs +++ b/src/Conclave.App/Sessions/Database.cs @@ -160,6 +160,17 @@ public static string DefaultPath() return System.IO.Path.Combine(dir, "conclave.db"); } + // Worktrees live under ~/.Conclave on every platform — separate from the app-data + // directory (which on Windows sits inside AppData\Roaming\Conclave) so per-file paths + // stay clear of Windows' 260-char MAX_PATH limit. Every saved character matters: the + // 32-char project id and slug already cost ~40, and git itself appends paths like + // ".git/worktrees//index.lock" inside the linked worktree. + public static string DefaultWorktreeRoot() + { + var home = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); + return System.IO.Path.Combine(home, ".Conclave"); + } + public static long Now() => DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(); private void Migrate() diff --git a/src/Conclave.App/Sessions/SessionManager.cs b/src/Conclave.App/Sessions/SessionManager.cs index aae2159..aa70894 100644 --- a/src/Conclave.App/Sessions/SessionManager.cs +++ b/src/Conclave.App/Sessions/SessionManager.cs @@ -50,8 +50,7 @@ public static SessionManager Open(Tokens tokens) { var dbPath = Database.DefaultPath(); var db = Database.Open(dbPath); - var root = Path.Combine(Path.GetDirectoryName(dbPath)!, "worktrees"); - return new SessionManager(db, root, tokens); + return new SessionManager(db, Database.DefaultWorktreeRoot(), tokens); } // --- Loading --- diff --git a/src/Conclave.App/ViewModels/NewSessionVm.cs b/src/Conclave.App/ViewModels/NewSessionVm.cs index 6f216f9..ad7a3e2 100644 --- a/src/Conclave.App/ViewModels/NewSessionVm.cs +++ b/src/Conclave.App/ViewModels/NewSessionVm.cs @@ -91,7 +91,7 @@ public string WorktreePath var slug = DeriveSlug(_branch); if (_project.IsFusion) return $"{_project.MemberIds.Count} worktrees · {slug}"; - return $"worktrees/{_project.Id[..8]}/{slug}"; + return $"~/.Conclave/{_project.Id[..8]}/{slug}"; } }