FileStream with HTML5 not working?

Kelevra

New member
Joined
Mar 24, 2019
Messages
4
Hi all.

I have a bug that might just be local to me as it doesn't seem like anyone else on the forum has been having the same issue.

Basically, I'm having trouble with the FilesStream command when used in the 'Html5 game' in both release and debug. When I go to compile and run, it doesn't even get as far as the browser but opens up the filestream.cxs source file and points to about line 12 which says that "Native FileStream class not implemented." (it seems ok when running on the windows build etc).

I had a look at the LANG variable which governs the error and this is set to .js, so it is looking for the FileStream.js file in \Cerberus\modules\brl\native. Needless to say, the cpp, java, cs versions are there but no js version. Is this right? I did a quick google for FileStream.js and chucked in the first thing that came up, but it didn't work (no surprises but I had to try).

Am I missing something from the cerberus build/zip file? I've re-installed it with the latest but it's still not working for me. Anyone have any ideas?

Thanks for your time.

Cerberus:
Import mojo
Import brl.filestream

Class Game Extends App

    Method OnCreate()
        Print "OnCreate"
        Local myFile:FileStream = FileStream.Open("cerberus://internal/world.dat", "r")
        SetUpdateRate(30)
    End

    Method OnUpdate()
        Print "OnUpdate"
    End

    Method OnRender()
        Print "OnRender"
        Cls 0,0,0
    End

End

Function Main()

    New Game()

End
 

SLotman

Active member
3rd Party Module Dev
Tutorial Author
Joined
Jul 3, 2017
Messages
233
Filestream is not implemented in HTML5. It never was, since Monkey-X days.

And it probably never will, since Filestream is binary read/write access to local files and that is a big NO-NO on HTML. Security issues and all that.

On HTML5 you can only use LoadString and SaveString, which AFAIK uses cookies.
 

MikeHart

Administrator
CX Code Contributor
3rd Party Module Dev
3rd Party Target Dev
3rd Party Tool Dev
Joined
Jun 19, 2017
Messages
3,454
Correct. I will move this topic.
 
Top Bottom