Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
_OpenFile Dialog in same folder as exe
#12
(12-05-2022, 03:12 AM)SMcNeill Wrote: Personally, I'd go this way:

Code: (Select All)
$If WIN Then
    Dim Shared As String * 1 Slash: Slash = "\"
$Else
        Dim Shared As String * 1 Slash: Slash = "/"
$End If

Print ExePath


Function ExePath$
    ExePath$ = Left$(Command$(0), _InStrRev(Command$(0), Slash) - 1)
End Function


Here we sort out our slash direction to begin with, and save it in a stored variable for use whenever it's needed in our program.  After all, if it's needed to find ExePath, then it's going to be needed when we try and make use of that path and open a file, or anything else with it as well.  Wink

Yes makes sense to have slash ready for other file work.
b = b + ...
Reply


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



Users browsing this thread: 11 Guest(s)