Updates for Windows & Ar 2.0: ResolvedPath, Win drive letters#29
Conversation
- Windows links to drive-based files need three leading slashes - Ar 2.0 no longer has `AnchorRelativePath`; replace w/ `CreateIdentifier` - expandPath returns a `ResolvedPath` that needs to be converted to string before being passed to python in a couple of places Signed-off-by: Gary Oberbrunner <garyo@darkstarsystems.com>
|
CLA submitted just now. |
|
Thank you! Once I get the OK from DWA, I’ll start testing internally. |
|
Just so you don't think this got lost in the ether, I was out on leave for a good while and one of our people that needs to approve this internally is likewise out for a bit longer, but I'll try to get it pushed through in the next few weeks. Apologies for the lengthy delay! |
| def pathForLink(path): | ||
| """Need three slashes before drive letter on Windows; this prepends one, so | ||
| with the usual two URL slashes we'll get the proper format.""" | ||
| if os.name == 'nt' and re.match(r'^[a-zA-Z]:[/\\]', fullPath): |
There was a problem hiding this comment.
We should probably pre-compile this regex at the top of this module and re-use it, since pathForLink will get called a lot when large files are loaded.
| context = resolver.CreateDefaultContextForAsset(path) | ||
| with Ar.ResolverContextBinder(context): | ||
| anchoredPath = path if parentPath is None else resolver.AnchorRelativePath(parentPath, path) | ||
| anchoredPath = path if parentPath is None else resolver.CreateIdentifier(path) |
There was a problem hiding this comment.
I think we should do an "if" here similar to this to maintain compatibility with older asset resolvers. Thoughts?
|
I'm likely going to make some minor tweaks based on my above comments, but otherwise, this should be good to go. We'll be releasing a new 0.14 very soon. |
AnchorRelativePath; replace w/CreateIdentifierResolvedPaththat needs to be converted tostring before being passed to python in a couple of places
Signed-off-by: Gary Oberbrunner garyo@darkstarsystems.com