Normal-case-path?
On Thursday, October 21, 2010, Danny Yoo <d...@cs.wpi.edu> wrote: > On Thu, Oct 21, 2010 at 11:23 AM, scouic <sco...@gmail.com> wrote: >> Hi, >> i think that the problem is the \ character, because this works : >> #lang racket >> (equal? (regexp-replace* "\\\\" (path->string (build-path "C:\\")) "/") >> (regexp-replace* "\\\\" (path->string (build-path "C:\\")) "/")) >> >> and returns true > > > Unfortunately, I'm occasionally getting paths where the entire path is > lowercased, and at other times, I'm getting it in mixed case: case > sensitivity is the issue I'm hitting. > > The unsatisfactory solution I've got so far is: > > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; > ;; same-path?: path path -> boolean > ;; Produces true if both paths are pointing to the same file. > (define (same-path? p1 p2) > (cond > [(eq? (system-path-convention-type) 'windows) > (string=? (string-downcase (path->string (normalize-path p1))) > (string-downcase (path->string (normalize-path p2))))] > [else > (string=? (path->string (normalize-path p1)) > (path->string (normalize-path p2)))])) > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; > _________________________________________________ > For list-related administrative tasks: > http://lists.racket-lang.org/listinfo/users _________________________________________________ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users