[Implemented] New constant: #PB_Compiler_FilePath

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
helpy
Enthusiast
Enthusiast
Posts: 552
Joined: Sat Jun 28, 2003 12:01 am

[Implemented] New constant: #PB_Compiler_FilePath

Post by helpy »

Hello,

Besides the following constant ...

Code: Select all

#PB_Compiler_File     : Full path and name of the file being compiled, useful for debug purpose.
... it would be helpful to have a constant with the full path to the actual file being compiled, ie.: #PB_Compiler_FilePath

With this constant it would be easier to handle nested include files!

Code: Select all

XIncludeFile #PB_Compiler_FilePath + "include_X.pbi"
XIncludeFile #PB_Compiler_FilePath + "..\include_Y.pbi"
cu, guido
Windows 10 / Windows 7
PB Last Final / Last Beta Testing
User avatar
helpy
Enthusiast
Enthusiast
Posts: 552
Joined: Sat Jun 28, 2003 12:01 am

Post by helpy »

... aaaah ...

I found a way to do what I want with a little trick (mentioned in a different topic):

Code: Select all

Macro RXIncludeFile
	XIncludeFile #PB_Compiler_File + "\..\" + 
EndMacro

RXIncludeFile "include_X.pbi"
RXIncludeFile "..\include_Y.pbi"
RXIncludeFile "subDir\include_Z.pbi"
This I can use in every source file ... and it is always relative to the source file, where RXIncludeFile is used.
Windows 10 / Windows 7
PB Last Final / Last Beta Testing
User avatar
helpy
Enthusiast
Enthusiast
Posts: 552
Joined: Sat Jun 28, 2003 12:01 am

Post by helpy »

... a new include command (like the little macro in the post before) would be very helpful:

RXIncludeFile <RelativeFilePath> ... R[elative]XIncludeFile is always relative to the current source file ... this would be a nice and helpful alternative to XIncludeFile.

cu, guido
Windows 10 / Windows 7
PB Last Final / Last Beta Testing
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »

I suggest an implementation of some #PB_Compiler_SourcePath
to be used in combination with IncludePath.

would be more consistent than adding a new command.
oh... and have a nice day.
Post Reply