This commit is contained in:
2026-06-10 08:45:11 +02:00
parent 930903fb42
commit 3b61e358dc
10 changed files with 190 additions and 63 deletions
+6 -11
View File
@@ -113,22 +113,17 @@
(define (file-exists?/quiet p)
(with-handlers ([exn:fail? (lambda (_) #f)]) (file-exists? p)))
(define (path-file-name-string p)
(let-values ([(base name dir?) (split-path p)])
(and (path? name) (path->string name))))
(define (manager-temp-path? p)
(define name (path-file-name-string p))
(and name
(string-prefix? name ".")
(regexp-match? #rx"\\.tmp-[0-9.]+\\.(flac|opus)$" name)))
(define (flac-path? p)
(and (file-exists?/quiet p) (extension-ci=? p ".flac")))
(define (opus-path? p)
(and (file-exists?/quiet p) (extension-ci=? p ".opus")))
(define (manager-temp-path? p)
(define-values (_base name _dir?) (split-path p))
(and (path? name)
(regexp-match? #rx"^\\..*\\.tmp-[0-9.]+\\.(flac|opus)$" (path->string name))))
(define (regular-file-path? p)
(file-exists?/quiet p))
@@ -150,7 +145,7 @@
(let loop ([dir root] [acc '()])
(for/fold ([acc acc]) ([p (in-list (sort-paths (directory-list/quiet dir)))])
(cond [(directory-exists?/quiet p) (loop p acc)]
[(file-exists?/quiet p) (cons p acc)]
[(and (file-exists?/quiet p) (not (manager-temp-path? p))) (cons p acc)]
[else acc]))))
(define (replace-path-extension p ext)