
Getting Program Exe directory?
Getting Program Exe directory?
How do I get the path to the program's exe and its directory? 

- Fluid Byte
- Addict
- Posts: 2336
- Joined: Fri Jul 21, 2006 4:41 am
- Location: Berlin, Germany
Try this code with a saved and unsaved project to see the difference:
Code: Select all
Debug ProgramFilename()
Debug GetCurrentDirectory()
Windows 10 Pro, 64-Bit / Whose Hoff is it anyway?
GetCurrentDirectory() can be affected by all kinds of procedures. For example, if your application prints using MS document writer then that will reset the current directory (and cause srod many hours of bug hunting! grrrr....) The point is that GetCurrentDirectory() can never be trusted to return the folder in which the executable resides.
I may look like a mule, but I'm not a complete ass.
I'm surprised no one has posted this yet:
Code: Select all
Debug GetFilePart(ProgramFilename()) ; Program name
Debug GetPathPart(ProgramFilename()) ; Program directory
-
- Enthusiast
- Posts: 480
- Joined: Thu Jul 27, 2006 4:06 am
-
- Addict
- Posts: 4777
- Joined: Thu Jun 07, 2007 3:25 pm
- Location: Berlin, Germany
Also according to another thread, it seems that it can't harm trying to clarify something ... 

I think we shouldn't suspect other people of doing strange things without knowing hard facts.
Regards, Little John

You obviously mean the 2 accounts with the names "Chirantha" and "buzzqw", no? It seems to be a misunderstanding, and I think the situation is pretty simple:superadnim wrote:what? did you use 2 accounts to post and then reply?. I sense that your "voice engine" doesn't really need to know all those things you asked on the previous posts ... are you writing malware?.
People wrote some explanations, and thenbuzzqw wrote:i use GetCurrentDirectory()
isn't good ?
Everything as clear as mud?buzzqw wrote:ok, thanks to all!

I think we shouldn't suspect other people of doing strange things without knowing hard facts.
Regards, Little John
-
- Enthusiast
- Posts: 480
- Joined: Thu Jul 27, 2006 4:06 am