Code archives/Miscellaneous/Application Directory

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

Download source code

Application Directory by fredborg
(Posted 22 years ago)
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

Picklesworth
(Posted 22 years ago)
I was looking for that just a few days ago.
Thanks!

erbbysam
(Posted 22 years ago)
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

nawi
(Posted 20 years ago)
Thank you very much

Code Archives Forum