[racket] reliable path comparison?

From: Eli Barzilay (eli at barzilay.org)
Date: Wed Oct 20 22:25:34 EDT 2010

Four minutes ago, Danny Yoo wrote:
> I'm trying to compare two paths for equality; I misread
> normalize-path and didn't realize that it does not do case folding,
> so that on Windows,
>    (equal? (build-path "C:\\")
>               (build-path "c:\\"))
> returns false.  What's the right way to compare paths for equality?

IIRC, there was no right way -- I think that on windows you can have
some drives be case-sensitive and some are not.

> As a related question, what's the right way to see if one directory
> is a subdirectory of another?

Explode the two and check if one is a prefix of the other?

          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!

Posted on the users mailing list.