01-10-2023, 06:45 PM
One function to set the direction of your slashes for the proper OS. It's just that simple.
Code: (Select All)
foo$ = "./mydir/foo.txt"
Print foo$
Print setSlash$(foo$)
foo2$ = ".\mydir\foo.txt"
Print foo2$
Print setSlash$(foo2$)
foo3$ = "./mydir\foo.txt"
Print foo3$
Print setSlash$(foo3$)
Function setSlash$ (text$)
temp$ = text$
$If WIN Then
desiredSlash$ = "\"
badSlash$ = "/"
$Else
desiredSlash$ ="/"
badSlash$ = "\"
$End If
Do
p = InStr(temp$, badSlash$)
If p Then Mid$(temp$, p, 1) = desiredSlash$
Loop Until p <= 0
setSlash$ = temp$
End Function