aboutsummaryrefslogtreecommitdiff
path: root/worker
diff options
context:
space:
mode:
Diffstat (limited to 'worker')
-rw-r--r--worker/maildir/worker.go11
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