Fix message-file naming; add .server to channel-list
This commit is contained in:
parent
5801f14046
commit
5248c4b32d
12
chatdir.scm
12
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
|
||||
name
|
||||
(string-pad
|
||||
(number->string (+ (or (and (string? suffix)
|
||||
(string->number suffix))
|
||||
0)
|
||||
.1)))
|
||||
1))
|
||||
4 #\0))
|
||||
leaf)))
|
||||
|
||||
|
||||
|
|
Reference in New Issue