var f = Titanium.Filesystem.getFile(Titanium.Filesystem.resourcesDirectory, 'properties.txt');
var writeStream = Titanium.Filesystem.getFileStream(f);
writeStream.open(Titanium.Filesystem.MODE_WRITE);
writeStream.write("this is the new file");
writeStream.close();
我收到错误“无法在对象中找到函数getFileStream ”
答案 0 :(得分:1)
https://developer.appcelerator.com/apidoc/mobile/1.3/Titanium.Filesystem-module
Titanium.Filesystem.getFile返回一个Titanium.Filesystem.File对象,您将其设置为变量f
http://developer.appcelerator.com/apidoc/desktop/latest/Titanium.Filesystem.File.open-method.html
编辑:您可以尝试完全评论您的第一行。将完整路径提供给getFileStream,这可以显示其getFile是否会导致问题。在root(C :)下保存测试文件并尝试
var writeStream = Titanium.Filesystem.getFileStream("C:\test.txt");
writeStream.open(MODE_WRITE);
writeStream.write("perhaps this will work");
writeStream.close();