Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
_OpenFile Dialog in same folder as exe
#1
I want the DefaultPathAndFile$ where my exe is.

_StartDir$ sure didn't get it, that's my QB64 exe folder

_Cwd$ works if I have been in folder for awhile but sometimes seems to be wrong when just starting cold.

So I am trying this:
Code: (Select All)
Function ExePath$
    Dim As Long t1, t2
    t1 = _InStrRev(Command$(0), "\")
    t2 = _InStrRev(Command$(0), "/")
    If t1 > t2 Then ExePath$ = Left$(Command$(0), t1 - 1) Else ExePath$ = Left$(Command$(0), t2 - 1)
End Function

Look alright?  I add forward slash in case of Linux, Windows doesn't care. It seems to be working for all the tests I gave trying to get out of _CWD$
  724  855  599  923  575  468  400  206  147  564  878  823  652  556 bxor cross forever
Reply


Messages In This Thread
_OpenFile Dialog in same folder as exe - by bplus - 12-04-2022, 08:28 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Unicode Open File and Browse Folder Dialogs SpriggsySpriggs 0 442 12-17-2024, 06:14 PM
Last Post: SpriggsySpriggs

Forum Jump:


Users browsing this thread: 1 Guest(s)