#PB_Compiler_ExecutableFile
Posted: Sat Sep 12, 2015 4:52 pm
I propose add the constants stored path to the compiled executable. This is useful for working with files in a folder with a compiled executable.
http://www.purebasic.com
https://www.purebasic.fr/english/
Huh? You want the path where a compiled executable is, to be stored as a constant in that executable?User_Russian wrote:I propose add the constants stored path to the compiled executable. This is useful for working with files in a folder with a compiled executable.
This makes sense during debugging (run in IDE PB).Little John wrote:That does not make sense
User_Russian wrote:Assume that the source code is in the "C:\folder_1\folder_2\".
The executable file is compiled into "..\" that is in "C:\folder_1\".
In the folder with the executable file is located a configuration file, etc. files. Is necessary know the path to the compiled executable file for use these files.
Code: Select all
Debug #PB_Compiler_FilePath + "..\"
Code: Select all
; Compiler Options > [v] Create temporary executable in the source directory
Debug GetPathPart(ProgramFilename()) + "..\"
And where exactly should the path to the executable be stored??User_Russian wrote:Not known in advance where there will executable. Its location may change at any time and can forget to change the source code by specifying the correct path to the executable.
Little John wrote:Storing it in the exectuable itself doesn't make sense.
User_Russian wrote:This makes sense during debugging (run in IDE PB).
For the reasons that I wrote, up to now it doesn't make any sense to me (regardless how often you repeat some short sentences).User_Russian wrote:Little John wrote:Storing it in the exectuable itself doesn't make sense.User_Russian wrote:This makes sense during debugging (run in IDE PB).
When you believe that your suggestion makes sense, then why don't you explain in detail how it should work?Little John wrote:And when the location of the executable may change at any time, how could then PB know where it is?
I already wrote why this is necessary.Little John wrote:When you believe that your suggestion makes sense, then why don't you explain in detail how it should work?
User_Russian wrote:This makes sense during debugging (run in IDE PB).
Assume that the source code is in the "C:\folder_1\folder_2\".The executable file is compiled into "..\" that is in "C:\folder_1\".
In the folder with the executable file is located a configuration file, etc. files. Is necessary know the path to the compiled executable file for use these files.
Yes, you already wrote this and that.User_Russian wrote:I already wrote ...Little John wrote:When you believe that your suggestion makes sense, then why don't you explain in detail how it should work?
So how can a changing path be stored in the constant #PB_Compiler_ExecutableFile?User_Russian wrote:Not known in advance where there will executable. Its location may change at any time and can forget to change the source code by specifying the correct path to the executable.
Little John wrote:So how can a changing path be stored in the constant #PB_Compiler_ExecutableFile?
And how exactly can it be used for debugging?
Code: Select all
CompilerIf #PB_Editor_CreateExecutable
Path.s = GetPathPart(ProgramFilename()))
CompilerElse ; Debug mode.
Path.s = GetPathPart(#PB_Compiler_ExecutableFile)
CompilerEndIf
OpenPreferences(Path+"Setting.ini")
; Other code.
I'm assuming that you're proposing the addition of a pre-defined target for the executable, as is normally found in other programming IDEs, where debug and release folders are implemented.User_Russian wrote:I propose add the constants stored path to the compiled executable. This is useful for working with files in a folder with a compiled executable.
With such an option for the release build, the paths of the various dependencies within the code could remain relative to that folder instead of the folder of the temporary build.PureBasic Manual - Compiling your programs wrote:Create temporary executable in the source directory
With this option turned on, the temporary executable file for running the program from the IDE will be placed inside the source directory. This can be useful if the program depends on files inside the source directory for testing. With this option turned off, the executable is created in the systems temporary directory.
It's truly bad form to disparage the language aptitude of our international friends; especially when you are clearly no grammarian yourself, Herr LJ.Little John wrote:That does not make sense...
That please explain it more detailed (?), in understandable English.
But you still did not explain in detail how such a constant could help (in) solving the problem -- although I have asked repeatedly.
So how can a changing (changeable?) path be stored in the constant #PB_Compiler_ExecutableFile?