Hi, Ladislav.
> I know, that it has been discussed, but I think, that the following
improvement to Core Exists? may be useful.
> Any suggestions are welcome.

Can you give an example where REBOL's 'exists? fails, and your's works
better, please?

Andrew Martin
ICQ: 26227169
http://members.xoom.com/AndrewMartin/
-><-



----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, 27 February 2000 8:49 AM
Subject: [REBOL] exists?


> Hi, Rebols,
>
> I know, that it has been discussed, but I think, that the
> following improvement to Core Exists? may be useful.
> Any suggestions are welcome.
>
> Regards,
>     Ladislav
>
> exists?: func [
>     {
>         Determines if a file or URL exists.
>
>         Checks for invalid HTML pages.
>     }
>     target [file! url!]
>     /local port comp ts
> ][
>     if error? try [
>             port: make port! target
>             query port
>     ] [return false]
>     if not port/status [return false]
>     if port/scheme = 'HTTP [
>         ts: to string! target
>         if (to string! port/url) = ts [
>             return true
>         ]
>         comp: copy "http://"
>         if port/host [append comp port/host]
>         if comp = ts [
>             return true
>         ]
>         if (append copy comp #"/") = ts [
>             return true
>         ]
>         if port/path [append comp port/path]
>         if comp = ts [
>             return true
>         ]
>         if port/target [append comp port/target]
>         if comp = ts [
>             return true
>         ]
>         return false
>     ]
>     true
> ]
>
>

Reply via email to