diff options
author | Moritz Poldrack <git@moritz.sh> | 2023-05-09 17:19:43 +0200 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2023-05-16 13:56:58 +0200 |
commit | ecfb22ad85bffb76b814b60ed82b48d0a245b32b (patch) | |
tree | 16598cb7ec811e72a2eb1a7ca7bf46543f63aaee /commands | |
parent | 2040fc1885ca4b4bea07d91e9fc6a0aaebfe7133 (diff) | |
download | aerc-ecfb22ad85bffb76b814b60ed82b48d0a245b32b.tar.gz |
archive: respect delimiter
Since we now have support for using a server's custom delimiter, it's
only right to also make use of this circumstance in the :archive
command.
Use the provided delimiter to join the path elements in the :archive
command.
Signed-off-by: Moritz Poldrack <git@moritz.sh>
Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'commands')
-rw-r--r-- | commands/msg/archive.go | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/commands/msg/archive.go b/commands/msg/archive.go index aeb65738..1c9d7929 100644 --- a/commands/msg/archive.go +++ b/commands/msg/archive.go @@ -3,7 +3,7 @@ package msg import ( "errors" "fmt" - "path" + "strings" "sync" "git.sr.ht/~rjarry/aerc/commands" @@ -70,15 +70,21 @@ func archive(aerc *widgets.Aerc, msgs []*models.MessageInfo, archiveType string) switch archiveType { case ARCHIVE_MONTH: uidMap = groupBy(msgs, func(msg *models.MessageInfo) string { - dir := path.Join(archiveDir, + dir := strings.Join([]string{ + archiveDir, fmt.Sprintf("%d", msg.Envelope.Date.Year()), - fmt.Sprintf("%02d", msg.Envelope.Date.Month())) + fmt.Sprintf("%02d", msg.Envelope.Date.Month()), + }, aerc.SelectedAccount().Worker().PathSeparator(), + ) return dir }) case ARCHIVE_YEAR: uidMap = groupBy(msgs, func(msg *models.MessageInfo) string { - dir := path.Join(archiveDir, fmt.Sprintf("%v", - msg.Envelope.Date.Year())) + dir := strings.Join([]string{ + archiveDir, + fmt.Sprintf("%v", msg.Envelope.Date.Year()), + }, aerc.SelectedAccount().Worker().PathSeparator(), + ) return dir }) case ARCHIVE_FLAT: |