Thursday, 23 October 2008

framework.system.filesystem

Making a bit of progress now - framework.system.filesystem look like it should do what I want.
I have tried this:
function buttonClicked() {
debug.trace("ButtonClicked");
fname=framework.BrowseForFile("*|*.*");
oFs = framework.system.filesystem;
alert("oFs="+oFs);
if oFs.FileExists(fname) {
alert("file exists!");
oFile = oFs.GetFile("/home/graham/Countdown.js");
oStream = oFile.OpenAsTextStream(1,-2);
linstr = oStream.ReadLine;
alert("ofile="+ofile+" linstr="+linstr);
} else {
alert("file "+fname+" does not exist");
}
}
It looks promising - oFs is a real native object, which is encouraging, but I get an 'uncaught exception' error - still needs some digging into how it works!

No comments: