cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: patch to make drive letters work in file:// urls under Windows

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Wed, 6 Aug 2003 10:38:19 -0700

On Wed, Aug 06, 2003 at 08:31:33AM -0700, David Byron wrote:
> Seems too simple, but here's a patch to get curl to understand drive letters
> (i. e. absolute paths) in Windows. Before this patch,
>
> $ ./curl -v file://localhost/src/cobra/curl/tests/log/test200.txt
>
> curl would look in /src/cobra/curl/tests/log/test200.txt of the current
> drive. After this patch, curl looks in src/cobra/curl/tests/log/test200.txt
> relative to the current directory.

I don't think the semantics of this form of URL should be any different
on Windows than any other platform. If you want a relative path, the
URL file:src/cobra/curl/tests/log/test200.txt should do it (I don't know
if curl supports that form or not, but it should).

> However, before this patch,
>
> $ ./curl -v file://localhost/c:/src/cobra/curl/tests/log/test200.txt
>
> curl would look for /c:/src/cobra/curl/tests/log/test200.txt and not find
> anything. After this patch, curl looks in
> c:/src/cobra/curl/tests/log/test200.txt and happily finds what it's looking
> for.

This part is good. Perhaps change the patch to do something like:

  if (*actual_path == '/' &&
      (actual_path[2] == ':' || actual_path[2] == '|'))
    { actual_path[2] = ':'; actual_path++; }

but better, with an end-of-buffer check and make sure you're allowed to change
the | to : there in that buffer like that.

> It gets as far through the testsuite as before the patch. Not saying much I
> suppose since %PWD still doesn't do the right thing for native Windows
> builds.
>
> Please let me know what you think.
>
> Thanks.
>
> -DB
>

>>> Dan

-- 
http://www.MoveAnnouncer.com              The web change of address service
          Let webmasters know that your web site has moved
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
Received on 2003-08-06