Topic: Does ChumbyCore::GetFileContents work?
I'm writing an app to be run off a USB stick (well, actually /mnt/storage -- but that's extra complication) on a C8, and would very much like to have some data persistence. Hence, I've been using ChumbyCore in an attempt to read and write files.
The writing goes just fine -- ChumbyCore::SetFileContents works like a champ, creating the file when needed, overwriting it otherwise, and just generally doing the right thing.
But the reading doesn't work at all! This code . . .
// Check that file exists
if(! cc.FileExists(fileName)) return;
trace("Loading '" + fileName + "': verified file exists.");
// Check that we can access it by reading the size
var size:int = cc.GetFileSize(fileName);
trace("File size: " + size);
var xml:String = cc.GetFileContents(fileName, 10000);
if(xml == null) {
trace("Results null.");
} else {
. . .
}
. . . produces this output:
2011-12-31 12:23:22 TRACE: Loading '/mnt/storage/sync/options.xml': verified file exists.
2011-12-31 12:23:22 TRACE: File size: 1929
2011-12-31 12:23:22 TRACE: Results null.
I've read that the maxBytes value isn't really optional, so I've tried fiddling with that -- leaving it off, making it zero, making it a very big number, to no avail. I know the file's there; it can read the size (and plus, ls tells me so ). And I don't think it's a permissions issue, since the program created the file in the first place. Google's no help, and I'm not sure what's going on. No matter what I do, the file contents come back null!
Given the general lack of information available on ChumbyCore, I can't help but wonder . . . is there some secret handshake I'm missing that makes this function actually read a file? Or does GetFileContents not work at all?