Re: Rework of mbox provider
Chris Burdess <[email protected]>
| Newsgroups | gmane.comp.java.classpath.extensions.javamail |
|---|---|
| Message-ID | <[email protected]> |
Countach wrote:
> If I understand the new code correctly, the MBOX code will now name
> folders differently depending on the platform. i.e. the hierarchy
> separator is backslash for windows platform and forword slash for
> Unix.
>
> I wonder if this isn't a step backwards? Previously the MBOX hierarchy
> separator was always forward slash regardless of platform (just like
> URLs),
Actually there was an inconsistency in the old code: the hierarchy
separator was always reported as being the platform separator, but
folder paths were only interpreted as if the separator was a slash.
> and code that uses it doesn't have to worry about what platform it is
> on. Now with this setup, the clients of this library have to do a lot
> more work to get the same level of platform independance.
I agree. I've applied a patch which allows you to use either a slash or
the platform separator. The Folder.getFullName method will report the
platform separator though, as will getSeparator. You can also use
URLNames to reference your mailboxes, which always use slashes in their
pathnames.
This code change gives you more options with DOS/Windows filenames; in
particular, you should be able to do something like
Folder f = store.getFolder("C:\\My Mailboxes\\My Inbox.mbx");
as well as
Folder f = store.getFolder("C:/My Mailboxes/My Inbox.mbx");
and
Folder f = store.getFolder(new
URLName("mbox:///C%3A/My%20Mailboxes/My%20Inbox.mbx"));
--
Chris Burdess