inky icon indicating copy to clipboard operation
inky copied to clipboard

Inky: Include in sub folders requires wrong path

Open colorfulKati opened this issue 3 years ago • 6 comments

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!

colorfulKati avatar Mar 29 '21 15:03 colorfulKati

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. image

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.

Liance avatar Apr 08 '21 18:04 Liance

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.

image

image

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.

Liance avatar Apr 10 '21 18:04 Liance

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.

russellquinn avatar Jan 22 '22 01:01 russellquinn

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 avatar Jan 23 '22 17:01 colorfulKati

@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.

russellquinn avatar Jan 24 '22 17:01 russellquinn

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..

chriswoodie avatar Feb 10 '23 14:02 chriswoodie