feat(file-manager): sync the working directory by default

The panel and the shell now share their directory out of the box; whoever wants
the previous independence sets sync_cwd no. The request is only written once the
shell has published its directory, since that file is what proves its
integration hook will read the request: a shell without shell integration still
gets the cd typed into the terminal instead of losing the change.
This commit is contained in:
BlackAngelTV committed 2026-11-11 08:35:19 +01:00
1 parent 1b330bcf81
commit e7e4e849eb
7 files changed
+61 -16

No files matched your search

+20
View File
@@ -45,6 +45,26 @@ func TestPublishRequestIsReadableAndLeavesNoTemporaryFile(t *testing.T) {
}
}
func TestShellHasHookNeedsAPublishedDirectory(t *testing.T) {
dir := t.TempDir()
s := new_shell_sync(dir, "5", true)
if s.shell_has_hook() {
t.Fatal("the shell published nothing yet")
}
if err := s.publish_request(dir); err != nil {
t.Fatal(err)
}
if s.shell_has_hook() {
t.Fatal("a request must not be mistaken for a published directory")
}
if err := os.WriteFile(filepath.Join(dir, "5"), []byte(dir), 0o600); err != nil {
t.Fatal(err)
}
if !s.shell_has_hook() {
t.Fatal("a published directory means the shell has the hook")
}
}
func TestShellCwdIgnoresUnusablePaths(t *testing.T) {
dir := t.TempDir()
s := new_shell_sync(dir, "9", true)