12-05-2022, 05:36 AM
(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.
Yes makes sense to have slash ready for other file work.
b = b + ...