blitz-foundation / monkey2

zlib License
3 stars 0 forks source link

FileStream doesn't recognise Windows paths #72

Closed Pharmhaus-2 closed 5 years ago

Pharmhaus-2 commented 5 years ago

Original Author: DruggedBunny

Can't use "\" in file paths! This shows the file failing to open, then switching path to "/" to succeed...

#Import "<std>"

Using std..

Function Main ()

    Local f:String = "C:\Windows\System32\notepad.exe" ' Never assume system paths!

    If GetFileType (f) = FileType.File

        Local file:FileStream = FileStream.Open (f, "r")

        If file
            Print "OK"
            file.Close ()
        Else
            Print "Failed to open file " + f
            file = FileStream.Open (f.Replace ("\", "/"), "r")
            If file
                Print "OK with slashes switched to " + f.Replace ("\", "/")
                file.Close ()
            Endif
        Endif

    Endif

End
Pharmhaus-2 commented 5 years ago

Fixed in develop.