Subject: [Imap-uw] detecting a relative path

From: "Ties Molenhuis" <[email-masked]>
Date: Thu, 16 Jun 2005 11:02:18 +0200

Hi Mark,

In the imap library there are several lines of code to detect if a path is relative or not.
The code to detect an absolute path on the windows platform is not sufficient I think.

if (name[1] == ':')

Is is detecting if the drive is specified but not if the path is relative or absolute.
The path c:tmp is valid and relative to the current directory on drive c.

The code below does also detect if the path is relative or absolute:
if (name[1] == ':' &&  (name[2] == '/' || name[2] == '\\'))

regards,
Ties Molenhuis
_______________________________________________
Imap-uw mailing list
[email-masked]
https://mailman1.u.washington.edu/mailman/listinfo/imap-uw

---

From: Mark Crispin <[email-masked]>
Date: Thu, 16 Jun 2005 06:34:09 -0700 (PDT)

If you're referring to the code in mailboxfile() in env_nt.c, you are 
correct.  However, this is more of a comment issue than a code error; the 
code is arguably correct as-is.

What the code is really doing is seeing if the path is absolute or is to 
another device.

If not, then it makes the path absolute by prefixing it with the home 
directory.  It can't do that when the path refers to another device, 
because the home directory only exists on the home device.  In that case, 
you're stuck with either forcing the other device reference to be a rooted 
name (that is, inserting \ after the :) or just leaving it alone.

The concensus seemed to be to leave it alone.

-- Mark --

http://staff.washington.edu/mrc
Science does not emerge from voting, party politics, or public debate.
Si vis pacem, para bellum.
_______________________________________________
Imap-uw mailing list
[email-masked]
https://mailman1.u.washington.edu/mailman/listinfo/imap-uw

---

From: "Ties Molenhuis" <[email-masked]>
Date: Mon, 20 Jun 2005 11:51:18 +0200

> code is arguably correct as-is.

A comment issue? When I open a mailbox file with a relative pathname, the function mail_open will sneaky prefix the given path with a "home directory". The result: I can't open the mailbox because imap has changed the path. But when I use a relative pathname prefixed with a drive letter, e.g. d:tmp, the path is not changed and the function mail_open opens the mailbox. I can't consider this as a comment issue.

The major question in this is: why is imap changing a given path? The minor: imap does this not for all give relative paths.

Regards,
Ties Molenhuis

---

From: Mark Crispin <[email-masked]>
Date: Mon, 20 Jun 2005 18:40:57 -0700 (Pacific Daylight Time)

The design of c-client is that all names are relative to the user's home 
directory.  When a different device is used, there is no home directory.

imap-2005 will force all device-name specifications to be rooted; that is, 
c:foo will be treated as c:\foo.

On Mon, 20 Jun 2005, Ties Molenhuis wrote:

> A comment issue? When I open a mailbox file with a relative pathname, 
> the function mail_open will sneaky prefix the given path with a "home 
> directory". The result: I can't open the mailbox because imap has 
> changed the path. But when I use a relative pathname prefixed with a 
> drive letter, e.g. d:tmp, the path is not changed and the function 
> mail_open opens the mailbox. I can't consider this as a comment issue.
>
> The major question in this is: why is imap changing a given path? The 
> minor: imap does this not for all give relative paths.
>
> Regards,
> Ties Molenhuis
>
>
>

-- Mark --