Hi, Andrew,
>> split-path %file.r
== [%./ "file.r"]
I don't think, that this is correct, because the second element of
the result has got a wrong type and, moreover, the first element
is incorrect, because the identity:
file = (append copy first r: split-path file second r)
is not preserved, which causes some problems when you want to
handle the following two cases:
a) %file.r
b) %./file.r
differently.
compare this to my version:
split-path %file.r
== [% %file.r]
split-path %./file.r
== [%./ %file.r]
>> split-path %dir/
== [%./ "dir"]
this is totally incorrect, compare this to my version:
split-path %dir/
== [%dir/ %]
Regards,
Ladislav
> [EMAIL PROTECTED] wrote:
> > after having some problems with split-path, here is my
version:
> >
> > (Andrew, it may be nice to have it in your %patch.r)
>
> > split-path %file.r
> > split-path %dir/
>
> These ones, I feel, aren't a problem. The existing
implementation of
> split-path is correct, I believe.
>
> > split-path to file! ""
>
> I agree that this one's incorrect, and needs fixing.
>
> Andrew Martin
> Bored with getmsg...
> ICQ: 26227169
> http://members.xoom.com/AndrewMartin/
> -><-
>
> ----- Original Message -----
> From: <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Saturday, 26 February 2000 9:23 PM
> Subject: [REBOL] Split-path correction
>
>
> > Hi,
> >
> > after having some problems with split-path, here is my
version:
> >
> > (Andrew, it may be nice to have it in your %patch.r)
> >
> > split-path: func [
> > {
> > Splits a file or URL. Returns a block containing path
and
> > target.
> >
> > Overcomes some limitations of the Core split-path like
> > strange results for:
> >
> > split-path %file.r
> > split-path %dir/
> > split-path to file! ""
> >
> > Moreover, the identity:
> >
> > file = (append copy first r: split-path file
second r)
> >
> > is always preserved.
> > }
> > file [file! url!]
> > /local path target
> > ] [
> > target: path: to string! file
> > parse path [any [#"/" target: | skip]]
> > path: copy/part path target
> > reduce [to file path to file target]
> > ]
> >
>
>
>