Page 1 of 1
Enhanced include capabilities
Posted: Thu Oct 30, 2003 12:36 am
by tinman
- AddIncludePath or similar, for multiple include paths
- The ability to include files from the relative path from where the current file is, for example:
Code: Select all
; filename: foo.pb
IncludePath "c:\"
XIncludeFile "sub_folder\bar.pb" ; Includes c:\sub_folder\bar.pb
And in that file...
Code: Select all
; filename: bar.pb
XIncludeFile "a_really_important_file.pb" ; Includes c:\sub_folder\a_really_important_file.pb
The current way PB works is to try to include c:\a_really_important_file.pb.
Posted: Mon May 02, 2005 3:36 pm
by Lebostein
My idea is: Add a new folder in PureBasic-Directory, for example "Includes". In this directory you can copy all your include files for using in different projects (like UserLibrary directory for your *.lib files):
- .
..
Catalogs
Compilers
Debugger
Examples
Includes (New!)
Library SDK
PureLibraries
Residents
....
When you include a file now (for example:
IncludFile "MyHighresTimer.pbi"), the compiler search for this file with follow priority:
1) Search in the new include directory -> If include not found:
2) Search in the folder adjusted by "IncludePath" -> If include not found:
3) Search in the current directory -> If include not found: Error!
So you have a global include directory and you need not set the include path every time in every project.
Posted: Mon May 02, 2005 10:36 pm
by Justin
yes we need the include directory(like most languages have). this simple things can make things much easier
but the PB updates should be very carefull not touching user files in that dir
Posted: Tue May 03, 2005 12:40 am
by dracflamloc
You can't include a file such as "./includes/test.pb" ???
Posted: Tue May 03, 2005 6:49 am
by Lebostein
Yes, very very useful.
Better to turn around the sequence of priority in my first post:
1) Search in the current directory -> If include not found:
2) Search in the folder adjusted by "IncludePath" -> If include not found:
3) Search in the new PB include directory -> If include not found: Error!
So you can 'overload' a include from the global include directory with a changed include with the same name in the current directory or in the directory adjusted by "IncludePath".
Posted: Tue May 03, 2005 9:57 am
by Justin
or just like in c
include <something> , searches the include dir
include "something" , searches the given path