[racket] reliable path comparison?

From: Eli Barzilay (eli at barzilay.org)
Date: Thu Oct 21 14:16:30 EDT 2010

5 minutes ago, Joe Marshall wrote:
> 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.

BTW, the relevant racket function for the first part is
`file-or-directory-identity'.

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


Posted on the users mailing list.