Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Getting the directory of the actual EXE?

Author
Message
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 2nd Jul 2012 16:18 Edited at: 2nd Jul 2012 16:20
Hi everyone


So recently I programmed a small "model preview" program for my games so my modellers know what their models will look like when implemented. They didn't want to have to search for the files in the application so taking some good advice from a friend I made it a drag-and-drop thing. You drag your model file onto the EXE and that's it, the program opens it and displays it. This is done with the command cl$().

So far so good, now here's the problem. The application requires some effect files which are placed in the same directory as the application. These fail to load when I drop a model file onto the application from a directory other than that of the application. The reason why? The current directory changes to the directory of the file you drop. Go try it out if you want. Just compile the code below and drop some random files onto the resulting EXE file, each from different directories. You'll see that the get dir$() command changes every time.



How do I find the directory of the EXE?

TheComet

Max P
16
Years of Service
User Offline
Joined: 23rd Jan 2010
Location:
Posted: 2nd Jul 2012 16:29 Edited at: 2nd Jul 2012 16:30
Matrix1Util_24 has a 'dir exe()' command, this will return the directory of the exe.

TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 2nd Jul 2012 17:05 Edited at: 2nd Jul 2012 17:05
basjak
16
Years of Service
User Offline
Joined: 16th Apr 2010
Location: feel like signing up for mars
Posted: 3rd Jul 2012 04:17
I still dont uderstand the Cl$() because I tried all ways and always got an empty string.

Login to post a reply

Server time is: 2026-07-08 01:55:03
Your offset time is: 2026-07-08 01:55:03