From a2875f61b622e55bf891bc6030dfac85b0b4f508 Mon Sep 17 00:00:00 2001 From: Hans Dijkema Date: Tue, 28 Apr 2026 23:39:05 +0200 Subject: [PATCH] path-equal? built --- gui.rkt | 2 +- utils.rkt | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/gui.rkt b/gui.rkt index e287579..d6f2260 100644 --- a/gui.rkt +++ b/gui.rkt @@ -426,7 +426,7 @@ (set! nr (+ nr 1)) (list (format "row-~a" nr) (build-path current-music-path e) (format "path-~a" nr))) (directory-list current-music-path))))) - (unless (equal? (format "~a" current-music-path) (format "~a" music-library)) + (unless (path-equal? current-music-path music-library) (set! l (cons (list "lib-up" "↰" "lib-up") l)) ) (let ((html (mktable l 'music-library library-formatter))) diff --git a/utils.rkt b/utils.rkt index 8f0c44d..af02604 100644 --- a/utils.rkt +++ b/utils.rkt @@ -20,6 +20,7 @@ fatal-rktplayer (all-from-out simple-log) list-drop! + path-equal? ) @@ -117,3 +118,22 @@ (call-with-values (λ () (split-path file)) (λ (dir file d) dir)) file))) + +(define (path-equal? p1 p2) + (let ((p1* (build-path p1)) + (p2* (build-path p2)) + ) + (let ((e1 (explode-path (normal-case-path p1))) + (e2 (explode-path (normal-case-path p2)))) + (if (= (length e1) (length e2)) + (letrec ((f (λ (l1 l2) + (if (null? l1) + #t + (if (string=? (format "~a" (car l1)) (format "~a" (car l2))) + (f (cdr l1) (cdr l2)) + #f))))) + (f e1 e2)) + #f) + ) + ) + ) \ No newline at end of file