From 5248c4b32d6a2d8462719e28a907e0118662362a Mon Sep 17 00:00:00 2001 From: Jaidyn Ann <10477760+JadedCtrl@users.noreply.github.com> Date: Tue, 6 Jun 2023 11:32:04 -0500 Subject: [PATCH] Fix message-file naming; add .server to channel-list --- chatdir.scm | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/chatdir.scm b/chatdir.scm index 754d386..bcc2323 100644 --- a/chatdir.scm +++ b/chatdir.scm @@ -26,6 +26,7 @@ channel-messages-by-date channel-messages-by-date* channel-messages-by-date-range ) + (import scheme (chicken file) (chicken file posix) (chicken pathname) (chicken port) (chicken io) (chicken random) (chicken string) @@ -39,7 +40,7 @@ ;; Lists all currently-joined channels. (define (channels root) - (directory root)) + (append (directory root) '(".server"))) ;; Creates a channel's file hierarchy; safe to run, even if the channel @@ -367,17 +368,20 @@ ;; a number to the end of the name, as necessary. (define (directory-unique-file directory name #!optional (suffix "")) (let* ([leaf - (string-append name suffix)] + (string-append name (if (not (string-null? suffix)) "." "") + suffix)] [path (subpath directory leaf)]) (if (file-exists? path) (directory-unique-file directory - leaf - (number->string (+ (or (and (string? suffix) - (string->number suffix)) - 0) - .1))) + name + (string-pad + (number->string (+ (or (and (string? suffix) + (string->number suffix)) + 0) + 1)) + 4 #\0)) leaf)))