[plt-scheme] parsing windows path on linux?

Eli Barzilay eli at barzilay.org
Sat Jan 10 23:14:05 EST 2009


On Jan 10, YC wrote:
> 
> I tried to use bytes->path to generate a `windows-path`, but
> `file-name-from-path` doesn't appear to work with `windows-path`.

It looks like the reason for this is that a non-default-platform path
is not considered as a path in the `path?' sense -- so you get an
error.  But you can use `split-path' directly (which is what
`file-name-from-path' is doing):

(let-values ([(base file dir?)
              (split-path (bytes->path #"c:\\foo\\bar.txt" 'windows))])
  file)

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



More information about the plt-scheme mailing list