diff --git a/audio-manager.rkt b/audio-manager.rkt index aa2d7df..49e5350 100644 --- a/audio-manager.rkt +++ b/audio-manager.rkt @@ -479,7 +479,7 @@ (info-am "Finished walking music library") ;; Cleanup files in target, not in source (info-am "Checking files in target, not in source") - (let ((fwt (make-file-walker opus-path "*" target-tree-cleaner))) + (let ((fwt (make-file-walker opus-path "*" target-tree-cleaner #:clean-os-name #f))) (let loop1 () (let-values (((base-path path info) (fwt))) (if (eq? info #f) diff --git a/private/file-walker.rkt b/private/file-walker.rkt index af5a344..1a9663c 100644 --- a/private/file-walker.rkt +++ b/private/file-walker.rkt @@ -29,7 +29,8 @@ (define (make-file-walker base-path glob-pattern filter-func - #:filename-cleaner [filename-cleaner-func (λ (f) f)]) + #:filename-cleaner [filename-cleaner-func (λ (f) f)] + #:clean-os-name [clean-os-name #t]) (let* ((gen (make-next-gen base-path glob-pattern)) (next-gens '()) (str-base-path* (format "~a" (normalize-path base-path))) @@ -53,13 +54,14 @@ (walker-func))) (let* ((bd (basedir path)) (bn (format "~a" (basename path))) - (nbn (filename-cleaner-func (clean-os-basename bn))) + (nbn* (if (eq? clean-os-name #t) (clean-os-basename bn) bn)) + (nbn (format "~a" (filename-cleaner-func nbn*))) ) (unless (string=? bn nbn) (with-handlers ([exn? (λ (e) (warn-am "Cannot rename dirty filename: ~a, ~a" nbn e))]) - (info-am "Renaming ~a to ~a (basedir: ~a)" bn nbn bd) + (info-am "Renaming '~a' to '~a' (basedir: ~a)" bn nbn bd) (rename-file-or-directory (build-path bd bn) (build-path bd nbn) #f) (set! path (build-path bd nbn))