open-simulation-platform / libcosim

OSP C++ co-simulation library
https://open-simulation-platform.github.io/libcosim
Mozilla Public License 2.0
61 stars 10 forks source link

UNC config paths not supported #619

Closed eidekrist closed 9 months ago

eidekrist commented 4 years ago

Loading a config with for instance an OspSystemStructure.xml located on a server drive, such as

\\my.company\user\configuration

results in an error with the following message:

Could not create execution from OspSystemStructure.xml file: No resolvers available to handle URI: MyModel.fmu

kyllingstad commented 9 months ago

I've looked into this and figured out why it happens.

The system structure file path \\my.company\user\configuration\OspSystemStructure.xml becomes the file URI file://my.company/user/configuration/OspSystemStructure.xml. This is then used as the base URI for resolving model URI references, so MyModel.fmu becomes file://my.company/user/configuration/MyModel.fmu.

The problem is that fmu_file_uri_sub_resolver::lookup_model() deliberately rejects file URIs with a non-empty authority field (my.company in this case). The reason is that the interpretation of such a URI is not well defined. The file URI scheme simply says that the authority part should contain the fully qualified domain name of the host on which the file is located, but it leaves the access mechanism undefined. So the file could be on a network share, an FTP server, etc.

However, the standard interpretation on Windows is as a network share, which was the actual case presented here. So the fix I have in mind now is to remove the authority check on Windows and use this interpretation.

kyllingstad commented 9 months ago

Fixed by #755.