[MERGE] Win32 fixes
John Arbash Meinel
john at arbash-meinel.com
Fri Apr 21 15:06:14 BST 2006
Aaron Bentley wrote:
> John Arbash Meinel wrote:
>>> There are a *lot* more illegal characters than just '<>'. The list I
>>> always remember is '\/?<>":*|'
>
> Sure. My primary motivation was justifying skipping tests that used '<>'.
>
>>> So we either need to treat ':' specially (as in make sure it is in the
>>> beginning, but doesn't exist in the rest of the path). Or just punt for now.
>
> So would this be a good way of detecting a *legal* windows path?
>
> re.match('([A-Z]:\\\\)?[^:<>*\"\'?]*$', 'C:\\ee')
>
>>> But since baz-import uses 'Arch:foo' it would be a lot nicer for the
>>> user to get an IllegalPath exception, than some random OS error.
>
> Yes, it's pretty random, alright. It looks like ENOENT! Why oh why
> can't they give us a reasonable errno, so we don't have to predict
> what's valid?
>
> Aaron
Actually, ' is a valid character on a windows path. And I'm sure we want
to support forward slashes instead of requiring back slashes. I thought
internally all paths were forward slashed anyway. And at the point we
are at, the path is an absolute path, so I would change it to:
_validWin32PathRE = re.compile(r'^[A-Z]:/[^:<>*"?\|\\]*$')
If we want to support either slash form, then it would be
_validWin32PathRE = re.compile(r'^[A-Z]:[/\\][^:<>*"?\|]*$')
John
=:->
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060421/1544406b/attachment.pgp
More information about the bazaar
mailing list