Closed FQAlmeida closed 2 weeks ago
This is due to how std::path::Path:: canonicalize
works on windows, since the file is on your local machine it uses \\?\
as part of the UNC path. Stripping the prefix would be fine in this case, but it could result in invalid paths if someone tries to load a remote file (not sure if this would actually work).
I haven't tried pkl on Windows due to the CLI not being tested on there (pretty sure this is why it detects \
as an illegal character), but I think using dunce to handle this on Windows could work
Absolute paths on Windows should turn into file URIs, where:
So this path: C:\Users\otavi\projetos\Pkl-Teste\configs\simple.pkl
Should turn into: file:///C:/Users/otavi/projetos/Pkl-Teste/configs/simple.pkl
See note here: https://pkl-lang.org/main/current/language-reference/index.html#relative-uris
Im trying to work with Pkl on Windows, and when I call
from_config::<Simple>("./configs/simple.pkl")
, the evaluator tries to parsefile://\\?\C:\Users\otavi\projetos\Pkl-Teste\configs\simple.pkl
, but backslashes and the question mark are invalid characters.To be precise, I receive the following error message:
I got it to work be just replacing \ to / and removing ?, but I dont know if it is safe to do that.