proton:filemanager
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
proton:filemanager [2010/10/28 05:30] – created seth | proton:filemanager [2012/03/09 01:05] (current) – seth | ||
---|---|---|---|
Line 49: | Line 49: | ||
====How to stream a file in==== | ====How to stream a file in==== | ||
- | To insure a hassle free Android compile you should use FileManager:: | + | To insure a hassle free Android compile you should use FileManager:: |
Why would you want to do this and not just load it all in one chunk? | Why would you want to do this and not just load it all in one chunk? | ||
Line 75: | Line 75: | ||
* We used **StreamingInstance:: | * We used **StreamingInstance:: | ||
* It internally cached the file for speed, for instance, if it's actually in a compressed zip and you are asking for one byte at a time it will really be decoding in 4 KB chunks behind the scenes | * It internally cached the file for speed, for instance, if it's actually in a compressed zip and you are asking for one byte at a time it will really be decoding in 4 KB chunks behind the scenes | ||
+ | |||
+ | ====Mounting a .zip as a filesystem==== | ||
+ | This happens automatically when you are doing an Android target, so you can load resources by filename and not worry about where they actually are. (Android wants to keep them in your .apk you used to install) | ||
+ | |||
+ | But you may want to mount your own zips for some reason. | ||
+ | |||
+ | <code cpp> | ||
+ | FileSystemZip *pFileSystem = new FileSystemZip(); | ||
+ | pFileSystem-> | ||
+ | |||
+ | //to print out the entire contents of the zip: | ||
+ | |||
+ | vector< | ||
+ | for (int i=0; i < contents.size(); | ||
+ | { | ||
+ | | ||
+ | } | ||
+ | |||
+ | //before mounting, we can optionally mount only a subdir of the zip by doing this: | ||
+ | pFileSystem-> | ||
+ | |||
+ | //to actually mount it | ||
+ | GetFileManager()-> | ||
+ | |||
+ | //test that it worked: | ||
+ | |||
+ | FileInstance myFile(" | ||
+ | |||
+ | if (myFile.IsLoaded()) LogMsg(" | ||
+ | </ | ||
====What about writing user data files?==== | ====What about writing user data files?==== | ||
I just use fwrite and fread and haven' | I just use fwrite and fread and haven' | ||
+ |
proton/filemanager.1288243810.txt.gz · Last modified: 2010/10/28 05:30 by seth