Page 1 of 1
How do we get the path to the running Harbour executable?
Posted: Sun Oct 31, 2021 2:41 pm
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.
Re: How do we get the path to the running Harbour executable?
Posted: Sun Oct 31, 2021 7:26 pm
by Claudio Ricardo
Hi... Try:
In HMG:
cPath := AllTrim ( GetCurrentFolder ())
In Clipper / Harbour:
cPath := AllTrim ( DirName())
Re: How do we get the path to the running Harbour executable?
Posted: Sun Oct 31, 2021 11:00 pm
by huiyi_ch
Hello,Try this function too:
hb_dirbase()
hb_DirBase() ➜ cDirName
returns the application's executable base directory (program statrtup directory).
Re: How do we get the path to the running Harbour executable?
Posted: Mon Nov 01, 2021 2:48 am
by vlademiro
Hi
Try hb_FNameDir( hb_DirBase() )
Re: How do we get the path to the running Harbour executable?
Posted: Mon Nov 01, 2021 7:05 pm
by HGAutomator
hb_dirbase(). Never heard of this one, but it does the trick.
Thanks Claudio, huiyi, and vlademiro.
Re: How do we get the path to the running Harbour executable?
Posted: Tue Nov 02, 2021 12:32 am
by vlademiro
Correction in my answer.
hb_DirBase() is the correct answer.
Other answer (not best) :
hb_FNameDir (ExeName()) // Requires hbct.hbc