-
Notifications
You must be signed in to change notification settings - Fork 222
[[ Library ]] Try extension when loading module #6669
base: develop-9.0
Are you sure you want to change the base?
Conversation
This patch moves the extension append and try code from `MCU_library_load` into the `CreateWithNativePath` implementaton of each `__MCSLibraryHandle` to allow binding strings to be cross platfor.
d633a68
to
20407fe
Compare
On consideration I'm not sure that this logic is correct for MCSLibrary - perhaps MCScript? The rationale here is that MCSLibrary really should allow you to bind to a specific library, this patch breaks that. In contrast, we can make what happens to library names part of the specification of binding strings in LCB. |
How does it break binding to any library? |
As in if extension wrangling fails it should in all cases try the original string |
If you have a foo.framework and a foo in the same folder - you can't load foo. |
hmm.. well in that case you can use an explicit extension and it will work I think... I can make that wok if it doesn't right now... let me check |
{ | ||
t_last_component_end -= strlen(t_framework_ext); | ||
} | ||
else if (p_has_extension) | ||
{ | ||
return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@runrevmark if there is an explicit extension and it's not framework the we back out here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right - but if there is no explicit extension and you have 'foo' and 'foo.framework', the framework codepath will trigger and you'll only ever bind to foo.framework - never foo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The order of trying things could be inverted, but then I'd get 'foo.framework' if 'foo' isn't there - which might not be what I want. (Again, this is only a concern because this is meant to be a thin wrapper around system functionality).
This patch moves the extension append and try code from
MCU_library_load
intothe
CreateWithNativePath
implementaton of each__MCSLibraryHandle
to allowbinding strings to be cross platfor.