Page 1 of 2

#PB_Compiler_ExecutableFile

Posted: Sat Sep 12, 2015 4:52 pm
by User_Russian
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.

Re: #PB_Compiler_ExecutableFile

Posted: Sat Sep 12, 2015 6:26 pm
by Little John
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.
Huh? You want the path where a compiled executable is, to be stored as a constant in that executable?
That does not make sense, since executables can and will be moved from one folder to another.

Or do you mean something else?
That please explain it more detailed, in understandable English.

Re: #PB_Compiler_ExecutableFile

Posted: Sat Sep 12, 2015 6:50 pm
by User_Russian
Little John wrote:That does not make sense
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.

Re: #PB_Compiler_ExecutableFile

Posted: Sat Sep 12, 2015 6:53 pm
by Keya
can you not use ProgramFilename() at runtime?

Re: #PB_Compiler_ExecutableFile

Posted: Sat Sep 12, 2015 6:57 pm
by User_Russian
ProgramFilename() returns the path to the temporary executable file that is located in a temporary folder or in a folder with the source code. It's not that is necessary.

Re: #PB_Compiler_ExecutableFile

Posted: Sat Sep 12, 2015 7:01 pm
by Little John
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 + "..\"
or

Code: Select all

; Compiler Options > [v] Create temporary executable in the source directory
Debug GetPathPart(ProgramFilename()) + "..\"

Re: #PB_Compiler_ExecutableFile

Posted: Sat Sep 12, 2015 7:22 pm
by User_Russian
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.

Re: #PB_Compiler_ExecutableFile

Posted: Sat Sep 12, 2015 7:52 pm
by Little John
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.
And where exactly should the path to the executable be stored??
Storing it in the exectuable itself doesn't make sense.
And when the location of the executable may change at any time, how could then PB know where it is?

Re: #PB_Compiler_ExecutableFile

Posted: Sat Sep 12, 2015 8:37 pm
by User_Russian
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).

Re: #PB_Compiler_ExecutableFile

Posted: Sun Sep 13, 2015 2:08 am
by juror
In that case make it #PB_Debug_ExecutableFile

Re: #PB_Compiler_ExecutableFile

Posted: Sun Sep 13, 2015 2:12 am
by Little John
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).
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).
How exactly could this feature be used in debugging?
Little John wrote:And when the location of the executable may change at any time, how could then PB know where it is?
When you believe that your suggestion makes sense, then why don't you explain in detail how it should work?

Re: #PB_Compiler_ExecutableFile

Posted: Sun Sep 13, 2015 7:31 am
by User_Russian
Little John wrote:When you believe that your suggestion makes sense, then why don't you explain in detail how it should work?
I already wrote why this is necessary.
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.

Re: #PB_Compiler_ExecutableFile

Posted: Sun Sep 13, 2015 7:54 am
by Little John
Sigh ... last try.
User_Russian wrote:
Little John wrote:When you believe that your suggestion makes sense, then why don't you explain in detail how it should work?
I already wrote ...
Yes, you already wrote this and that.
But you still did not explain in detail how such a constant could help solving the problem -- although I have asked repeatedly.
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.
So how can a changing path be stored in the constant #PB_Compiler_ExecutableFile?
And how exactly can it be used for debugging?

Re: #PB_Compiler_ExecutableFile

Posted: Sun Sep 13, 2015 8:05 am
by User_Russian
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.
Thus, the program will use the same files.

Re: #PB_Compiler_ExecutableFile

Posted: Sun Sep 13, 2015 8:09 am
by TI-994A
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.
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.

PureBasic provides this limited option for the temporary (debug) build, but not for the release 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.
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.
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?
It's truly bad form to disparage the language aptitude of our international friends; especially when you are clearly no grammarian yourself, Herr LJ. :wink:

In any case, when did you become the sheriff of the Feature Requests and Wishlists forum. :lol: