Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
_OpenFile Dialog in same folder as exe
#9
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
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 SMcNeill - 12-05-2022, 03:12 AM



Users browsing this thread: 2 Guest(s)