Please evaluate the full path name of #PB_Compiler_File
Posted: Sat Oct 09, 2010 7:22 am
Because PureBasic includes are relative to the main project file instead of the individual files themselves, I've had to resort to a clever solution provided by Trond:
http://www.purebasic.fr/english/viewtop ... 13&t=35288
http://www.purebasic.fr/english/viewtopic.php?t=30504
However, I have just realized that there is a cascading problem that affects #PB_Compiler_File when using this method. The actual path is never resolved for the local file in question, probably because it is assumed to be absolute (by design). This is causing the file path to get bigger and bigger as includes grow in depth until..
As a stopgap measure and to enable continued use of relative includes, "please" evaluate the full path name (such as with GetFullPathName) before assigning the value to #PB_Compiler_File!
Also of note with GetFullPathName from MSDN:
http://www.purebasic.fr/english/viewtop ... 13&t=35288
http://www.purebasic.fr/english/viewtopic.php?t=30504
However, I have just realized that there is a cascading problem that affects #PB_Compiler_File when using this method. The actual path is never resolved for the local file in question, probably because it is assumed to be absolute (by design). This is causing the file path to get bigger and bigger as includes grow in depth until..
This is probably because the path length has exceeded MATH_PATH.XIncludeFile #PB_Compiler_File+"\..\"+"lib.InterlockedCompareExchange.pb"
..
---------------------------
PureBasic
---------------------------
Line 9: File not found (\\acer\d\~\Workspaces\PureGDK\workspaces\installer\Installer.pb\..\..\..\includes\PureBasic\IsDBPLicensed\h.IsDBPLicensed.pb\..\..\CompileDBPExecutable\h.CompileDBPExecutable.pb\..\..\h.Window.pb\..\h.InterlockedCompareExchange.pb\..\lib.InterlockedCompareExchange.pb).
---------------------------
OK
---------------------------
..
Should have evaluated to: \\acer\d\~\Workspaces\PureGDK\includes\PureBasic\lib.InterlockedCompareExchange.pb
As a stopgap measure and to enable continued use of relative includes, "please" evaluate the full path name (such as with GetFullPathName) before assigning the value to #PB_Compiler_File!
Also of note with GetFullPathName from MSDN:
Ideally, I would like to see support for relative paths that are relative to the current file. This would alleviate the problem altogether as well. But simply evaluating the full path name, I believe, should be a very simple to implement solution that would provide immediate results.In the ANSI version of this function, the name is limited to MAX_PATH characters. To extend this limit to 32,767 wide characters, call the Unicode version of the function and prepend "\\?\" to the path. For more information, see Naming a File.