
Nesting include files (not really a bug but...)
@pdwyer
maybe i don't get it, but trond's example is indeed doing exctly what you want.
putinto math.pbi, and so for string.pbi is searched in the directory of math.pbi.
the thing is just, that you have to use the trick again when you are back in previous include levels (like a main.pb) if you want to further include files relatively from there. maybe that' the problem what you meant?
maybe i don't get it, but trond's example is indeed doing exctly what you want.
put
Code: Select all
IncludePath #PB_Compiler_File + "\.."
XIncludeFile "string.pbi"
the thing is just, that you have to use the trick again when you are back in previous include levels (like a main.pb) if you want to further include files relatively from there. maybe that' the problem what you meant?

Sorry Trond / #Null
You are indeed right. I assume I know what you meant and didn't test it.
Thanks! -- Time to clean up my includes!

Paul Dwyer
“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
Re: Nesting include files (not really a bug but...)
I know, I'm a bit late to contribute to this thread, but I just came about it looking for a solution for the "relative-include-thing" and I find the "IncludePath #PB_Compiler_File" - trick very nice and working fine. I just wanted to add that for me it gets even more handy using a small macro:
So one doesn't need IncludePath but can just write:
To me this looks neat and nice.
Code: Select all
Macro XIncludeFileRelative(FileName)
XIncludeFile #PB_Compiler_File + "/../" + FileName
EndMacro
Code: Select all
XIncludeFileRelative("includefile_in_the_same_directory.pb")
Re: Nesting include files (not really a bug but...)
The Constant #PB_Compiler_FilePath exists since PB Version 4.30 (16th December 2008)
Windows 10 / Windows 7
PB Last Final / Last Beta Testing
PB Last Final / Last Beta Testing
Re: Nesting include files (not really a bug but...)
Hi helpy,helpy wrote:The Constant #PB_Compiler_FilePath exists since PB Version 4.30 (16th December 2008)
thanks for the info! So the macro should better be like...
Code: Select all
Macro XIncludeFileRelative(FileName)
XIncludeFile #PB_Compiler_FilePath + FileName
EndMacro
-
- Addict
- Posts: 4777
- Joined: Thu Jun 07, 2007 3:25 pm
- Location: Berlin, Germany
Re: Nesting include files (not really a bug but...)
Very useful! Thanks especially to andrasch and helpy.
I'll just use (w/o a macro), but that's a matter of personal taste.
Regards, Little John
I'll just use
Code: Select all
XIncludeFile #PB_Compiler_FilePath + <respective filename>
Regards, Little John