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$
b = b + ...
Reply


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



Users browsing this thread: 19 Guest(s)