Page 1 of 1

[SOLVED] How to get the source file .pb directory ?

Posted: Sun Aug 18, 2019 4:57 pm
by forgottencoder
Hi everybody

1º source code is loaded from some directory in disk
2º Is there a way of getting the source file directory with code when you run the program with F5 ?

The goal is to do this automaticly and then add directories to it:

Code: Select all

getsourcecodedir()+"pbi/test.pbi"
xincludefile instruction already does this. It knows that pbi directory is one level depth from source code:

Code: Select all

xincludefile("pbi/test.pbi")

Re: How to get the source file .pb directory ?

Posted: Sun Aug 18, 2019 5:02 pm
by infratec
Hi, you have to set 'create temporary executable in source code directory'
You can find this in 'Compiler'->'Compile/Start'

Then you can use the ´directories in your source directory.

Re: How to get the source file .pb directory ?

Posted: Sun Aug 18, 2019 5:19 pm
by forgottencoder
Thanks infratec for pointing me in the right direction :D

Sharing a little code after activating IDE flag.

Code: Select all

directory$ = GetCurrentDirectory()
mypbipath$=directory$+"pbi"
Debug(mypbipath$)

Re: [SOLVED] How to get the source file .pb directory ?

Posted: Sun Aug 18, 2019 6:11 pm
by infratec
You directed yourself in the wrong direction :wink:

you don't need the path for includefiles "pbi\xyz.pbi"
is always working beside the sourcecode directory.

And if you realy need the path use:

Code: Select all

GetPathPart(ProgramFilename())
GetCurrentDirectory() does not always point to the path of the executable.