Brock,
On Windows, if someone used "C:\" for the path (an admittedly obscure case), then you'll end up with a return value of:

{"basename": "",  "path": "\\C:\\"}

Also, on Unix with the "/" case, this will return {"path": "//" }

Maybe a way to check for the top of the directory tree portably is:

if os.path.dirname(p) == p:

Tom

Brock Pytlik wrote:

I probably can collapse one of the checks out, but I need the if statement so that os.path.basename is never called on "/".

But I can change it to something that makes it more clear like....
if self.attrs["path"] == "/":
        return { "path": os.path.sep + self.attrs["path"] }
return {
        "basename": os.path.basename(self.attrs["path"].rstrip(os.path.sep))
        "path": os.path.sep + self.attrs["path"]

}


How does that look?

begin:vcard
fn:Tom Mueller
n:Mueller;Tom
org:Sun Microsystems, Inc.;Update Center Software
adr:;;21915 Hillandale Dr;Elkhorn;NE;68022;USA
email;internet:[EMAIL PROTECTED]
title:Senior Staff Engineer
tel;work:877-250-4011
tel;fax:877-250-4011
tel;home:402-916-9943
x-mozilla-html:TRUE
version:2.1
end:vcard

_______________________________________________
pkg-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss

Reply via email to