[racket] reliable path comparison?

From: Joe Marshall (jmarshall at alum.mit.edu)
Date: Thu Oct 21 14:11:27 EDT 2010

On Wed, Oct 20, 2010 at 7:20 PM, Danny Yoo <dyoo at cs.wpi.edu> 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?
>
> As a related question, what's the right way to see if one directory is
> a subdirectory of another?

Both of these operations are properly the domain of the operating system,
not Scheme/Racket.  There should be OS primitives or conventions for
comparing equality and checking subdirectory.  If these aren't provided by
the system, you'll have to conditionalize your own code.



-- 
~jrm


Posted on the users mailing list.