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

Just starting out? Need help? Post your questions and find answers here.
Nudgy
User
User
Posts: 12
Joined: Mon May 27, 2024 8:11 pm

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

Post 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.
User avatar
Sicro
Enthusiast
Enthusiast
Posts: 563
Joined: Wed Jun 25, 2014 5:25 pm
Location: Germany
Contact:

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

Post by Sicro »

  • PureBasic
  • Includes/MyInclude.pbi
  • Projects/MyProject/Main.pbi

Main.pb:

Code: Select all

IncludeFile "../../Includes/MyInclude.pbi"
Image
Why OpenSource should have a license :: PB-CodeArchiv-Rebirth :: Pleasant-Dark (syntax color scheme) :: RegEx-Engine (compiles RegExes to NFA/DFA)
Manjaro Xfce x64 (Main system) :: Windows 10 Home (VirtualBox) :: Newest PureBasic version
Nudgy
User
User
Posts: 12
Joined: Mon May 27, 2024 8:11 pm

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

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