cURL / Mailing Lists / curl-users / Single Mail

curl-users

RE: libcurl's treatment of `file:' and absolute paths

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 6 Aug 2001 16:14:53 +0200 (MET DST)

On Mon, 6 Aug 2001, Roth, Kevin P. wrote:

> Will there be a way to reference a file relatively? e.g. "foo" in the
> current directory? If so, will you document what it is?

Starting with this: no (as we want to be compatible with the other guys).
You'll have to craft the path yourself to get something from the current
directory (in pseudo code):

 $path = `pwd` # get current working directory
 curl file://localhost/$path/relativefile.txt

> Also, I haven't looked in the code, so this may not be an issue. But
> don't forget that Windows filenames start with c:\, which could look
> like:
>
> file:///c:/foo
> file://localhost/c:/foo
>
> or also could be a "UNC" path, like:
>
> file://\\machinename\sharename\foo
>
> (backslashes OR forward slashes are treated more or less the same in
> Internet Explorer).

None of those _should_ be an issue. I do expect that windows users will try
that and report if it doesn't work.

Uh, the last example is badly formatted though. The separator between the
host name and the path path is a '/'. That's nothing IE can change and
libcurl will insist on that. But a URL similar to:

        file:///\\machinename\sharename\foo

Would probably work, as long as open() works on the given path.

-- 
     Daniel Stenberg -- curl dude -- http://curl.haxx.se/
Received on 2001-08-06