Pdc on Windows doesn't seem to support import path relative to the current file

This is, at a minimum, a report of a different behaviour for pdc on macOS and Windows.

Easy way to replicate is to clone my game repo, get a Windows Powershell in the project's folder and typing:

pdc ./source

This give the error:

error: ./source\../toyboxes/toyboxes.lua:10: No such file: github.com/DidierMalenfant/Aspen/source/Aspen.lua

This path does exist and is relative to the file toyboxes.lua which contains this import.

On macOS this works fine but it seems like on Windows, pdc seems to expect all the paths from being relative to the original source folder which is a bit inconvenient.

Did I miss something on my end?

Hmmm I'm not sure if importing files outside of the folder is officially supported. The docs don't explicitly say this, but the recommended project structure has all files under the same parent folder. The docs say "Place all scripts and assets together in a single project directory", and in the example structure, all Lua files are under the same "source" directory.

With that said, PDC is including the SDK Lua files from the SDK directory, but I'm not sure if those are a special case :confused:

There is a limitation currently, you have to add the file extension. See this post: Import statement needs .lua extension for paths containing `..` - #3 by DidierMalenfant

Edit: Ha, this is your post. :slight_smile: It works for me on Windows in a simple example project if I add the lua extension. However, relative upward paths are definitely YMMV at this point.

Hmmm I'm not sure if importing files outside of the folder is officially supported.

Look to me like a bug. It's not working consistently on both platforms so there's definitely an issue there.

it works for me on Windows in a simple example project if I add the lua extension.

Yeah, my case already has .lua at the end of that path.

I wonder if, on Windows, they just treat relative paths as always relative to the source folder maybe? That would be odd but would explain the behaviour I'm seeing. I should test some more on a Windows machine.

Did some further tests and I could confirm that, on Windows at least, paths for an import are always relative to the initial folder where pdc was invoked and not the file's actual folder.

If this can be added to the list together with that other one it would be great.

This bug, of course, is a bit more important since it currently prevents code from being cross-platform.

Any updates on this for our Windows devs?