Code archives/Miscellaneous/Application Directory

This code has been declared by its author to be Public Domain code.

Download source code

Application Directory by fredborg2005
People often encounter problems when they make their final executables, and start them from a shortcut on the desktop or similar.

This will solve those problems!

Add it as the first thing in your code, and you're home free.
; Path to executable
Global apppath$ = SystemProperty$("appdir")
If Lower$(Right$(apppath$,4))="bin\"
	; Running from the IDE
	apppath$ = CurrentDir$()
End If
If Right$(apppath,1)<>"\" Then apppath = apppath+"\"
ChangeDir(apppath)

Comments

Picklesworth2005
I was looking for that just a few days ago.
Thanks!


erbbysam2005
neat stuff... I always run into this when I create an exeacutable packed setup file and then install and realise that the program doesn't know where to run from....Thanks


nawi2006
Thank you very much


Code Archives Forum