How do we get the path to the running Harbour executable?

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
HGAutomator
Posts: 202
Joined: Thu Jul 16, 2020 5:42 pm
DBs Used: DBF

How do we get the path to the running Harbour executable?

Post by HGAutomator »

I know this function is somewhere, I've used it. But cannot recall how to get the Path of the Harbour executable that's running, in order to extract the folder where it's running from.
User avatar
Claudio Ricardo
Posts: 367
Joined: Tue Oct 27, 2020 3:38 am
DBs Used: DBF, MySQL, MariaDB
Location: Bs. As. - Argentina

Re: How do we get the path to the running Harbour executable?

Post by Claudio Ricardo »

Hi... Try:
In HMG:
cPath := AllTrim ( GetCurrentFolder ())
In Clipper / Harbour:
cPath := AllTrim ( DirName())
Corrige al sabio y lo harás más sabio, Corrige al necio y lo harás tu enemigo.
WhatsApp / Telegram: +54 911-63016162
huiyi_ch
Posts: 173
Joined: Sat May 21, 2016 5:27 am

Re: How do we get the path to the running Harbour executable?

Post by huiyi_ch »

Hello,Try this function too:
hb_dirbase()
hb_DirBase() ➜ cDirName
returns the application's executable base directory (program statrtup directory).
vlademiro
Posts: 36
Joined: Mon Jun 01, 2020 4:17 am
DBs Used: DBF

Re: How do we get the path to the running Harbour executable?

Post by vlademiro »

Hi

Try hb_FNameDir( hb_DirBase() )
HGAutomator
Posts: 202
Joined: Thu Jul 16, 2020 5:42 pm
DBs Used: DBF

Re: How do we get the path to the running Harbour executable?

Post by HGAutomator »

hb_dirbase(). Never heard of this one, but it does the trick.

Thanks Claudio, huiyi, and vlademiro.
vlademiro
Posts: 36
Joined: Mon Jun 01, 2020 4:17 am
DBs Used: DBF

Re: How do we get the path to the running Harbour executable?

Post by vlademiro »

Correction in my answer.

hb_DirBase() is the correct answer.

Other answer (not best) :

hb_FNameDir (ExeName()) // Requires hbct.hbc
Post Reply