Data folder in Cerberus and Monkey

Gerry Quinn

New member
Tutorial Author
Joined
Jun 24, 2017
Messages
144
Hi, I've been working with an old Monkey project but switched to Cerberus as I needed to create data buffers and I have a newer version of MSVC that Monkey doesn't work with. Anyway, when reading them (HTML, but I assume it's the same for all targets) I found that Cerberus expects the data folder to be identified as "cerberus://data/" - "monkey//data/" doesn't work.

I suspect an official work-around would be clunky, and anyway I can fix things myself without too much difficulty, now that I know the problem. Probably worth knowing for anyone experimenting with databuffers etc. I was wondering, though, if there's any elegant way to check whether Monkey or Cerberus was used to build a program - a preprocessor value perhaps?
 

MikeHart

Administrator
Joined
Jun 19, 2017
Messages
2,815
Just to be clear that i understood it correctly...

monkey://data/ is not working?

Btw. There is a tool called CxConvert that I wrote long time ago to make an automatic conversion of monkey code.
 

Gerry Quinn

New member
Tutorial Author
Joined
Jun 24, 2017
Messages
144
code_language.cerberus:
Strict


Import brl.databuffer


Function Main:Int()
     Local bufferA:DataBuffer = DataBuffer.Load( "monkey://data/a.dat" )
     Local bufferB:DataBuffer = DataBuffer.Load( "cerberus://data/b.dat" )
     Print "A:  "
     If bufferA   
         Print bufferA.Length()
     End
     Print "B:  "
     If bufferB   
         Print bufferB.Length()
     End
     Return 0
End
Yes: for example the following code running on HTML5 gives "Cerberus Runtime Error : NetworkError: Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'monkey://data/a.dat'." when I try to load a.dat, whereas b.data will load perfectly and give the correct length. (a.dat and b.dat are copies, and it's still the same if I switch them around).
 

MikeHart

Administrator
Joined
Jun 19, 2017
Messages
2,815
Ah ok, yes, that is a small part, where CX in incompatible with Monkey X.
 

Gerry Quinn

New member
Tutorial Author
Joined
Jun 24, 2017
Messages
144
No problem - it's easy to deal with now that I know, and it's only going to happen if you are mixing the two, which I was doing for a very specific reason.
 

MikeHart

Administrator
Joined
Jun 19, 2017
Messages
2,815
Well in that case, there is nothing a self-introduced preprocessor setting can't fix for ya. :) May I ask what the very specific reason is that you still rely on Monkey X?
 

Gerry Quinn

New member
Tutorial Author
Joined
Jun 24, 2017
Messages
144
I meant that I had a specific reason for using both Monkey and Cerberus simultaneously in such a way that I was trying to read from the 'monkey' data directory. Basically because I was creating data files in GLFW (for which I used Cerberus) to be read from HTML (for which I'm still using Monkey).

No real reason still to be using Monkey except that I have to chase up the new version of Mollusc - I have of course confirmed that my project works on Cerberus.
 
Top Bottom