Index: [thread] [date] [subject] [author]
  From: Neal Tucker <ntucker@vax.area.com>
  To  : ggi-develop@eskimo.com
  Date: Sat, 8 Aug 1998 06:04:44 -0700

Re: / vs \ [Re: PenguinPlay IRC meeting. GGI developers wanted]

Adrian Ratnapala says:
> Neal Tucker wrote:
> 
> > An approach I have used for this in the past, which worked very well,
> > was to represent paths as URL's as much as possible.  You need some
> > simple utilities to convert a path to and from a URL based on your
> > platform, but it's really convenient that the path separators and
> > allowed chars are really well defined for URL's, and URL's are used on
> > all platforms.
> 
> I think you might be right.  The thing is of course that  it involes some
> bloat"small, yes, but it all adds up".  This is an issue for games.  How hard
> is it to
> do
> 
>    char* curr;
>     for(curr = s; curr*; curr++)
>         if(*curr=='/')*curr='\\';
> 
> Not exactly bulletproof, but probably good enough.
> 
> Ofcourse their is the multirooted filesystem stupidity to take care of.

I prefer to think of the problem not as "how do I convert UNIX paths
to DOS paths", but "how do I represent paths in a platform-independent
manner".  For example, your solution doesn't account for the fact that
there are characters not allowed in DOS paths that are allowed in UNIX
paths (and possibly vice-versa -- is '/' allowed in a DOS path?).  It
also doesn't address multiple drives (which you mention), nor will it
work for UNC paths ("\\thingy\blah\etc", which may be the same issue,
but requires thought).  Not to mention that this also ignores other
platforms, like the mac or others, which may or may not bother you.

Occasionally, I find myself saying "not exactly bulletproof, but good
enough," and I usually kick myself later.

-Neal Tucker

Index: [thread] [date] [subject] [author]