paulloz / godot-ink

Ink integration for Godot Engine.
MIT License
604 stars 42 forks source link

Fix includes when Ink files aren't in the root project directory #51

Closed shinyu6 closed 1 year ago

shinyu6 commented 1 year ago

This PR fixes an issue that arises when an Ink file isn't in the root Godot project directory and has INCLUDE statements. Take, for example, a file structure of:

ink/main.ink

INCLUDE foo.ink INCLUDE subdirectory/bar.ink

...

ink/foo.ink

...

ink/subdirectory/bar.ink

...

This structure works when loading ink/main.ink in the Inky editor; however, it doesn't work with the current InkStoryImporter because InkStoryImporter tries to load includes from the current working directory by default (thanks to the handling of the DefaultFileHandler here: https://github.com/inkle/ink/blob/6a512190365002f54bd501b0863ded40123cb8e5/compiler/FileHandler.cs#L11). This PR fixes the issue by loading INCLUDE directives from the path of the imported file, not from the project root.

paulloz commented 1 year ago

Thank you for your contribution!

paulloz commented 1 year ago

Hi, sorry for the random ping @shinyu6. You weren't added to the AUTHORS file for this. I'll make an update soon. Please tell me if you don't want to appear in it. Cheers.

shinyu6 commented 1 year ago

That's fine with me. Thanks for checking in!

On Wed, May 31, 2023, 3:30 AM Paul Joannon @.***> wrote:

Hi, sorry for the random ping @shinyu6 https://github.com/shinyu6. You weren't added to the AUTHORS file for this. I'll make an update soon. Please tell me if you don't want to appear in it. Cheers.

— Reply to this email directly, view it on GitHub https://github.com/paulloz/godot-ink/pull/51#issuecomment-1569933592, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATNIWKLCG45BMVP7OEI6NA3XI4MVJANCNFSM6AAAAAAXX44KQQ . You are receiving this because you were mentioned.Message ID: @.***>