diff options
author | Galen Abell <galen@galenabell.com> | 2020-02-25 16:35:57 -0500 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2020-02-25 16:36:37 -0500 |
commit | 5ba1569734be25f5f696b85c79788392a12bb0a3 (patch) | |
tree | dd43b3dcd32a42a902e5988432d1e30b7e01ef7b /worker/maildir/worker.go | |
parent | 2fcd77f101003b65590f6ab103d0b633b219587b (diff) | |
download | aerc-5ba1569734be25f5f696b85c79788392a12bb0a3.tar.gz |
Ensure new directory exists before unwatching old
Diffstat (limited to 'worker/maildir/worker.go')
-rw-r--r-- | worker/maildir/worker.go | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/worker/maildir/worker.go b/worker/maildir/worker.go index 1df4e09..3c15f2c 100644 --- a/worker/maildir/worker.go +++ b/worker/maildir/worker.go @@ -236,6 +236,12 @@ func (w *Worker) handleListDirectories(msg *types.ListDirectories) error { func (w *Worker) handleOpenDirectory(msg *types.OpenDirectory) error { w.worker.Logger.Printf("opening %s", msg.Directory) + // open the directory + dir, err := w.c.OpenDirectory(msg.Directory) + if err != nil { + return err + } + // remove existing watch path if w.selected != nil { prevDir := filepath.Join(string(*w.selected), "new") @@ -244,11 +250,6 @@ func (w *Worker) handleOpenDirectory(msg *types.OpenDirectory) error { } } - // open the directory - dir, err := w.c.OpenDirectory(msg.Directory) - if err != nil { - return err - } w.selected = &dir w.selectedName = msg.Directory |