bmx-ng / sdl.mod

SDL backend for BlitzMax
7 stars 6 forks source link

(SDL) GetBasePath() returns Null - "not compiled with sdl 2.0" #5

Closed GWRon closed 8 years ago

GWRon commented 8 years ago

When using "GetBasePath()" on my android device I get the following SDL_GetError()-message: Application not compiled with SDL 2.0

The result is, that GetBasePath() returns an empty string (as SDL_GetBasePath() returns null)

GWRon commented 8 years ago

Having a look at sdl.mod/SDL/src/filesystem/android/SDL_filesystem.c, `GetBasePath()" can only return Null ... so it seems to do what it should.

woollybah commented 8 years ago

You may want AndroidGetInternalStoragePath() instead?

GWRon commented 8 years ago

Nope, I wanted to make "libxml" be able to load a file from the assets-folder ... so I wanted to get the absolute path to the file on the android device.

I used the internal one (which is the same as the Pref-one) to store my base.util.logger.bmx-log-files - and when using "LoadDirectory()" I only see this log-file in the internal storage directory.

GWRon commented 8 years ago

Assume this is not possible as SDL directly loads from the APK. And as long as libXML does try to load it on its own, it wont do.

So I could try to circumvent it by loading the content via SDL and then feeding libXML with the string rather than the file.

woollybah commented 8 years ago

Can't you load via a TStream and ReadDoc() ?

GWRon commented 8 years ago

This is exactly what I tried to explain in the "circumvent"-phrase. Just having a google-look if there is an alternative. For now this is not that problematic, but if you imagine to have passed a bigger XML file (some MB) this means to have it completely stored in RAM when loading.

woollybah commented 8 years ago

How so? If you are reading from a TStream you are reading it directly from some file.

GWRon commented 8 years ago

Yeah but I have to load it to a string first (s:string = ReadStream("sdl::myxml.xml")). Then I can pass this string to libXML's parseDoc.

Or have I misunderstood something?

woollybah commented 8 years ago

Function ReadDoc:TxmlDoc(doc:Object...)

ReadDoc accepts a TStream, and should be able to load a TxmlDoc from it.

GWRon commented 8 years ago

Will give it a try .. totally missed that part.

GWRon commented 8 years ago

Short question: When using ReadDoc() with an OpenStream()-stream: when to close the stream? is after calling ReadDoc() enough?

woollybah commented 8 years ago

Yes, it should have finished loading it when the function returns.

GWRon commented 8 years ago

Ok, Thanks ... having some crashes now, it is time to check your new SDL_Log()-functions

GWRon commented 8 years ago

... Ok, loads the XML now on android. Thanks to SDL_Log() - and your help ;-)

woollybah commented 8 years ago

Cool :-)