diff options
author | Vitaly Ovchinnikov <v@ovch.ru> | 2023-11-07 16:14:01 +0000 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2023-11-12 12:53:11 +0100 |
commit | 7bd9239d94a5371eacf001766de9c2d53b7fde43 (patch) | |
tree | 0b6258e7ec2a6fbbed95efcf9409b4b4e777be32 /commands/account | |
parent | 2d589766d03ae7ccbd9a360e51e246e35afe394a (diff) | |
download | aerc-7bd9239d94a5371eacf001766de9c2d53b7fde43.tar.gz |
{im,ex}port-mbox: allow using ~ in path
Add ~ support to :export-mbox and :import-box the same way as it is done
in :save.
Signed-off-by: Vitaly Ovchinnikov <v@ovch.ru>
Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'commands/account')
-rw-r--r-- | commands/account/export-mbox.go | 3 | ||||
-rw-r--r-- | commands/account/import-mbox.go | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/commands/account/export-mbox.go b/commands/account/export-mbox.go index 14d9290e..2eed570a 100644 --- a/commands/account/export-mbox.go +++ b/commands/account/export-mbox.go @@ -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" @@ -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 != "" { diff --git a/commands/account/import-mbox.go b/commands/account/import-mbox.go index 7aa393b6..e326edce 100644 --- a/commands/account/import-mbox.go +++ b/commands/account/import-mbox.go @@ -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" @@ -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) |