Caching 删除applicationDataDirectory中的文件

Caching 删除applicationDataDirectory中的文件,caching,mobile,titanium,delete-file,Caching,Mobile,Titanium,Delete File,在Tianium中,删除applicationDataDirectory中特定文件的最佳方法是什么 最好的方法就是: var file = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory,filename); if ( file.exists() ) { file.deleteFile(); } 有关完整的详细信息。最好的方法是: var file = Titanium.Filesyst

在Tianium中,删除applicationDataDirectory中特定文件的最佳方法是什么

最好的方法就是:

var file = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory,filename);
if ( file.exists() ) {
     file.deleteFile();
}

有关完整的详细信息。

最好的方法是:

var file = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory,filename);
if ( file.exists() ) {
     file.deleteFile();
}

有关完整的详细信息。

删除文件就是这么简单

var f = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, 'delete_me.txt');
f.write('foo');
// make sure there's content there so we're sure the file exists
// Before deleting, maybe we could confirm the file exists and is writable
// but we don't really need to as deleteFile() would just return false if it failed
if (f.exists() && f.writeable) {
    var success = f.deleteFile();
    Ti.API.info((success == true) ? 'success' : 'fail'); // outputs 'success'
}

简单介绍文件系统的最好材料之一是:

删除文件就是这么简单

var f = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, 'delete_me.txt');
f.write('foo');
// make sure there's content there so we're sure the file exists
// Before deleting, maybe we could confirm the file exists and is writable
// but we don't really need to as deleteFile() would just return false if it failed
if (f.exists() && f.writeable) {
    var success = f.deleteFile();
    Ti.API.info((success == true) ? 'success' : 'fail'); // outputs 'success'
}
简单介绍文件系统的最佳材料之一: