open-simulation-platform / libcosim

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

Allow use of UNC paths on Windows #755

Closed kyllingstad closed 5 months ago

kyllingstad commented 6 months ago

This fixes issue #619.

File URIs generally have the form file://hostname/path/to/file. When hostname is not localhost (nor empty) the file URI scheme leaves the file access mechanism unspecified. However, on Windows, such URIs are commonly interpreted as UNC paths, so in this case it would be \\hostname\path\to\file. This PR simply enables us to take advantage of this interpretation, which is built into the Windows API functions we already use.

kyllingstad commented 5 months ago

The original issue (#619) is difficult to recreate in unittests too, but I did test locally on my machine that this PR solves it. (That is, I was able to run a simulation with an UNC path to OspSystemStructure.xml.)