This works for absolute paths:
>> d: "c:\my\dir\is\this"
== "c:\my\dir\is\this"
>> insert replace/all replace/all d ":" "" "\" "/" "/"
== "c/my/dir/is/this"
>> print d
/c/my/dir/is/this
>>

With partial paths you will need get some logic involved.  Also there may be some
issues with knowing if the path is a directory or a file.

--Ryan

[EMAIL PROTECTED] wrote:

> Could someone please fix this? It hung my interpreter:
>
> REBOL [
>         Title: "DOS-REBOL File Name Conversion Routines"
>         File:  %dosbol.r
>         Author: "Terrence Brannon"
>         Email:  [EMAIL PROTECTED]
>         Purpose: "Ease working with dos filename in REBOL programs"
>         Category: 'file
> ]
>
> dosbol: make object! [
>         char: make string! 0
>         out:  make string! 0
>         drive-letter: charset [ #"A" - #"F" ]
>
>         rules: [ copy char drive-letter ":" (out: rejoin [ "/" dl ]) |
>                  "\" (append out "/") |
>                  copy char (append out char)
>                 ]
>         d2r: func [
>          dos-fn [string!] "takes a dos filename and converts to rebol format"]
>          [
>           parse/all dos-fn [ any rules ]
>           out
>          ]
> ]
>
> >> dosbol/d2r "c:\temp\file"
>
> terrence-brannon: [[EMAIL PROTECTED] perl-refugee myth-gamer]
> free-email:       http://www.MailAndNews.com
> free-usenet:      http://www.mailAndNews.com
> ; all the above is real REBOL code, believe it or not.

Reply via email to