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

Just starting out? Need help? Post your questions and find answers here.
forgottencoder
User
User
Posts: 12
Joined: Sun Jul 21, 2019 1:46 am

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

Post 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")
Last edited by forgottencoder on Sun Aug 18, 2019 5:19 pm, edited 1 time in total.
infratec
Always Here
Always Here
Posts: 7712
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

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

Post 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.
forgottencoder
User
User
Posts: 12
Joined: Sun Jul 21, 2019 1:46 am

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

Post 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$)
infratec
Always Here
Always Here
Posts: 7712
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

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

Post 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.
Post Reply