spnda / fastgltf

A modern C++17 glTF 2.0 library focused on speed, correctness, and usability

Home Page:https://fastgltf.readthedocs.io/v0.7.x/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Buffer URIs are exported with backslash as directory separator on Windows

Cyphall opened this issue · comments

Calling fastgltf::FileExporter::setBufferPath with "." and adding a buffer named "test" results in the buffer URI having a backslash as separator in the generated glTF file:

"buffers":[
    {
        "uri":".\\test.bin",
        "byteLength":720,
        "name":"test"
    }
],

However, URIs are expected to only ever use forward slashes as separators.
This makes the glTF file invalid.

After going through the code, I believe that this issue is caused by the use of std::filesystem::path::string (which uses the native separators) instead of std::filesystem::path::generic_string (which always uses forward slashes as separators).

Thank you 😃