[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: in or out IDE


On Thu, 1 Oct 2026 at 15:19, Philippe Valarcher <philippe.valarcher@xxxxxxx>
wrote:

> Le jeudi 01 octobre 2026 à 14:52 +0100, Bruce Steers a écrit :
>
> Try this...
>
> #If Exec
> Print "run from the executable"
> #Else
> Print "Run from IDE"
> #Endif
>
> Read here...
> https://gambasgb.uk/phpBB/viewtopic.php?t=22
>
> Respects
> BruceS
>
>
> On Thu, 1 Oct 2026 at 11:12, valaquarus <valaquarus@xxxxxxxxx> wrote:
>
> How can you tell if you're launching a program from within the IDE or
> outside of it?
>
>
> Thank you Bruce that's nearly what I did and it makes it real good.
>
> --
>
> Philippe Valarcher <philippe.valarcher@xxxxxxx>
>

You're welcome.

It's not completely 100% bullet-proof but works in most cases.

For example if i was to start a program with gbx3 on the folder and not run
the compiled executable...
Eg.
$ gbx3 /path/to/program/folder

then the Exec pre-processor constant will not be set but we are also not
using the IDE.

It would be more useful i think if the IDE could also set a Flag/Env of
some sort, a more definitive indicator of an IDE test run as opposed to
launching the executable.
Perhaps if Benoit could give us something more reliable like a
pre-processor constant called IDE,
#if IDE Then

Respects
BruceS

Follow-Ups:
Re: in or out IDEBenoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>
Re: in or out IDEBruce Steers <bsteers4@xxxxxxxxx>
References:
in or out IDEvalaquarus <valaquarus@xxxxxxxxx>
Re: in or out IDEBruce Steers <bsteers4@xxxxxxxxx>
Re: in or out IDEPhilippe Valarcher <philippe.valarcher@xxxxxxx>