rusty
rusty copied to clipboard
Validate if paths in `include_path` exist
Describe the bug Given the following configuration file
{
"name" : "MyProject",
"files" : ["../src/**/*.st"],
"compile_type" : "Shared",
"output" : "prog.so",
"libraries" : [
{
"name" : "iec61131std",
"path" : "<path to iec61131std/lib>",
"package" : "Copy",
"include_path" : [
"<path to iec61131std/include/*.st>"
]
}
]
}
If the entries in include_path are invalid (i.e. the path doesn't exist), plc build config/plc.json will fail building if functions are used from the library. While this is expected, an additional error message telling the user "path xyz is invalid" would be great and reduce the time investigating the issue for them.
Additional context
Something along if !input.exists() { /* error */ } in resolve_file_paths should fix it, though I'm not sure if the exists() call will fail for relative paths.
https://github.com/PLC-lang/rusty/blob/73f559dbf15b11cf167b28b2d1f46d8fe1bcb127/compiler/plc_project/src/project.rs#L305-L320