summaryrefslogtreecommitdiff
path: root/internal/queue/queue.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2024-10-18 11:10:47 +0300
committerPaul Buetow <paul@buetow.org>2024-10-18 11:10:47 +0300
commit564e56404e5aecee3924e957adbe95bbb5880676 (patch)
tree411fb070f91c15a1f5aa096ed2ce2ae8289889ee /internal/queue/queue.go
parenta8f87b7393f24ccd2435ac455bc8c750a4c203e2 (diff)
also archiving the posts. generally, queueing now should be working
Diffstat (limited to 'internal/queue/queue.go')
-rw-r--r--internal/queue/queue.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/internal/queue/queue.go b/internal/queue/queue.go
index 32d645f..caf4f2e 100644
--- a/internal/queue/queue.go
+++ b/internal/queue/queue.go
@@ -27,7 +27,6 @@ func Run(args config.Args) error {
}
// Queue all *.txt into ./db/*.txt.STAMP.queued
-// TODO: This doesn't work correctly yet, neet to test it more!
func queueEntries(args config.Args) error {
ch, err := oi.ReadDirCh(args.GosDir, func(file os.DirEntry) (string, bool) {
filePath := filepath.Join(args.GosDir, file.Name())
@@ -78,8 +77,12 @@ func queuePlatforms(args config.Args) error {
if args.DryRun {
continue
}
- log.Println("Removing", filePath)
- if err := os.Remove(filePath); err != nil {
+ archivePath := filepath.Join(args.GosDir, "db", "archive", filepath.Base(filePath))
+ log.Printf("Archiving %s -> %s", filePath, archivePath)
+ if err := oi.EnsureParentDir(archivePath); err != nil {
+ return err
+ }
+ if err := os.Rename(filePath, archivePath); err != nil {
return err
}
}