Skip to content

Commit

Permalink
{im,ex}port-mbox: allow using ~ in path
Browse files Browse the repository at this point in the history
Add ~ support to :export-mbox and :import-box the same way as it is done
in :save.

Signed-off-by: Vitaly Ovchinnikov <[email protected]>
Acked-by: Robin Jarry <[email protected]>
  • Loading branch information
Vitaly Ovchinnikov authored and rjarry committed Nov 12, 2023
1 parent 2d58976 commit 7bd9239
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions commands/account/export-mbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"git.sr.ht/~rjarry/aerc/app"
"git.sr.ht/~rjarry/aerc/commands"
"git.sr.ht/~rjarry/aerc/lib"
"git.sr.ht/~rjarry/aerc/lib/xdg"
"git.sr.ht/~rjarry/aerc/log"
mboxer "git.sr.ht/~rjarry/aerc/worker/mbox"
"git.sr.ht/~rjarry/aerc/worker/types"
Expand Down Expand Up @@ -42,6 +43,8 @@ func (e ExportMbox) Execute(args []string) error {
return errors.New("No message store selected")
}

e.Filename = xdg.ExpandHome(e.Filename)

fi, err := os.Stat(e.Filename)
if err == nil && fi.IsDir() {
if path := acct.SelectedDirectory(); path != "" {
Expand Down
3 changes: 3 additions & 0 deletions commands/account/import-mbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (

"git.sr.ht/~rjarry/aerc/app"
"git.sr.ht/~rjarry/aerc/commands"
"git.sr.ht/~rjarry/aerc/lib/xdg"
"git.sr.ht/~rjarry/aerc/log"
"git.sr.ht/~rjarry/aerc/models"
mboxer "git.sr.ht/~rjarry/aerc/worker/mbox"
Expand Down Expand Up @@ -48,6 +49,8 @@ func (i ImportMbox) Execute(args []string) error {
return errors.New("No directory selected")
}

i.Filename = xdg.ExpandHome(i.Filename)

importFolder := func() {
defer log.PanicHandler()
statusInfo := fmt.Sprintln("Importing", i.Filename, "to folder", folder)
Expand Down

0 comments on commit 7bd9239

Please sign in to comment.