Page 1 of 1

IncludeFile with relative paths and directory traversal (for example ../) in Linux?

Posted: Sat Oct 25, 2025 9:15 pm
by Nudgy
Hi!

Is it possible somehow in Linux to specify an IncludeFile as a relative path with directory traversal (for example, "IncludeFile /../../mypath/myfile.pbi")

I am considering a new folder structure, where I don't want to put my project and multi-project include-files in the same folder, or put the include-files in a subfolder of PureBasic or a specific project, but rather in a folder structure like the example below:

- PureBasic folder: my/folder/here/PureBasic
- Includes folder: my/folder/here/Includes
- Projects folder: my/folder/here/Projects/MyProject

I have tried various possibilities without luck, such as:
- XIncludeFile #PB_Compiler_Home + "../Includes/MyInclude.pbi"
- XIncludeFile "/../../Includes/MyInclude.pbi"
- XIncludeFile "../../Includes/MyInclude.pbi"
- And setting a different path first with IncludePath

I prefer not to use absolute paths, to avoid breaking things too much if I later move around folders slightly.

Thank you.

Re: IncludeFile with relative paths and directory traversal (for example ../) in Linux?

Posted: Sun Oct 26, 2025 9:55 am
by Sicro
  • PureBasic
  • Includes/MyInclude.pbi
  • Projects/MyProject/Main.pbi

Main.pb:

Code: Select all

IncludeFile "../../Includes/MyInclude.pbi"

Re: IncludeFile with relative paths and directory traversal (for example ../) in Linux?

Posted: Sun Oct 26, 2025 5:31 pm
by Nudgy
You are right. I tested this again, and I must have made a mistake in my initial testing, because this works.

Thank you.