inky
inky copied to clipboard
Inky: Include in sub folders requires wrong path
Hello!
The issue is that in Inky you always need to include with the path relative to the main ink file.
So e.g. we have a folder Folder
which contains 2 files includes.ink
and test.ink
- the includes.ink
is included in the main ink file. Now we want to include test.ink
in includes.ink
which we have to do like so INCLUDE Folder/test.ink
because otherwise Inky complains that it can't find the file, even though both files are in the same folder.
The expected behaviour is that the include path should be relative to the file you're doing the include in.
This is especially a problem with the Unity integration, because includes.ink
is in Folder
and from there it looks for Folder/test.ink
so it constructs a path Folder/Folder/test.ink
which of course is wrong.
Thank you!
For anybody having this problem (or, I think, the problem in #333 ) - this seems to be a Windows thing.
For whatever reason, Windows formats any files nested deeper than 1 level deep with "/" and "", which messes up Inky when it runs checks for existing files.
This list of existing files is used when deciding what Inky saves (and what goes into the Unused files folder), so
I have an unholy fix for it here - https://github.com/Liance/inky/tree/windows-relpath-fix
It's a single line fix that standardizes all "/" or "" entries to just "/" with a simple string replacement when Inky checks for existing v.s. new files.
Here's some further information about this bug:
- As far as I could tell, it only occurs on Windows - I could not repro this bug on my Linux subsystems.
- It only occurs on files that are more than subfolder deep.
- It only occurs when the INCLUDE is written with forward slashes instead of back slashes- see below. The only difference in the files below is that they're written with / or \ - and only the \ files demonstrate this bug.
You can therefore avoid this bug entirely by writing your INCLUDEs with backslashes only. I do not consider this an adequate solution, as it's non-obvious, and it's very easy to lose your project by using forward slashes without knowing any better.
It's also very likely that this breaks OS-compatibility for nested projects.
I have this problem on macOS too.
I want to INCLUDE files within INCLUDEd files (i.e. nested INCLDUEs)
Inky requires full paths for all nested INCLUDEs.
Unity integration fails with this syntax.
The way we're solving the issue atm is by having the include-files next to the main file, so the files included within the include-files have the same path relative to the include-files as to the main file. Not super nice, but it works well for us. And the folder structures can be as deep as you want them to be.
@colorfulKati Good tip, thanks, but one of my main reasons for wanting nested includes, is so Inky groups them in a logical and structured way.
This is really, really annoying. Having the same issue on MacOS. Can't include anything unless putting them in the same scope, which you don't want most of the time..