Looks like Danek's response eliminated the need to deal with a path value of "/" or "C:\"
Tom

Brock Pytlik wrote:
Tom Mueller wrote:
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:\\"}
On windows, what should the basename be for C:\?
To be certain, the path should be C:\?
Also, on Unix with the "/" case, this will return {"path": "//" }
Hmm, ok, guess I'll fix that too since I'm mucking around in there.
Maybe a way to check for the top of the directory tree portably is:

if os.path.dirname(p) == p:
Ok, I'll try that.

Brock
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?


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

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

Reply via email to