#PB_Compiler_ExecutableFile

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User_Russian
Addict
Addict
Posts: 1520
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

#PB_Compiler_ExecutableFile

Post 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.
Little John
Addict
Addict
Posts: 4779
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: #PB_Compiler_ExecutableFile

Post 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.
User_Russian
Addict
Addict
Posts: 1520
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

Re: #PB_Compiler_ExecutableFile

Post 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.
Last edited by User_Russian on Sat Sep 12, 2015 6:54 pm, edited 2 times in total.
User avatar
Keya
Addict
Addict
Posts: 1890
Joined: Thu Jun 04, 2015 7:10 am

Re: #PB_Compiler_ExecutableFile

Post by Keya »

can you not use ProgramFilename() at runtime?
User_Russian
Addict
Addict
Posts: 1520
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

Re: #PB_Compiler_ExecutableFile

Post 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.
Little John
Addict
Addict
Posts: 4779
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: #PB_Compiler_ExecutableFile

Post 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()) + "..\"
User_Russian
Addict
Addict
Posts: 1520
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

Re: #PB_Compiler_ExecutableFile

Post 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.
Little John
Addict
Addict
Posts: 4779
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: #PB_Compiler_ExecutableFile

Post 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?
User_Russian
Addict
Addict
Posts: 1520
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

Re: #PB_Compiler_ExecutableFile

Post 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).
juror
Enthusiast
Enthusiast
Posts: 228
Joined: Mon Jul 09, 2007 4:47 pm
Location: Courthouse

Re: #PB_Compiler_ExecutableFile

Post by juror »

In that case make it #PB_Debug_ExecutableFile
Little John
Addict
Addict
Posts: 4779
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: #PB_Compiler_ExecutableFile

Post 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?
User_Russian
Addict
Addict
Posts: 1520
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

Re: #PB_Compiler_ExecutableFile

Post 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.
Little John
Addict
Addict
Posts: 4779
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: #PB_Compiler_ExecutableFile

Post 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?
User_Russian
Addict
Addict
Posts: 1520
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

Re: #PB_Compiler_ExecutableFile

Post 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.
User avatar
TI-994A
Addict
Addict
Posts: 2704
Joined: Sat Feb 19, 2011 3:47 am
Location: Singapore
Contact:

Re: #PB_Compiler_ExecutableFile

Post 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:
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel :D
Post Reply