質問

I was wondering if it was possible to create, remove and change files and directories using the TideSDK, I was wondering this because I'm just wondering if I can create an application which can save files using a custom file format, and load the file using a custom file format. I was also wondering if its possible to create directories using the TideSDK so that it may be possible to export projects for example, I load my custom file format, and I wish to export the project, *Creates new directory of the PROJECT_NAME in the Exports folder and the directory contains the exported files of some code I can write myself.

Is this possible?

役に立ちましたか?

解決

Yes, you can.

Here is an example from the documentation:

//Check for existance of a file
var document = Ti.Filesystem.getFile(Ti.Filesystem.getApplicationDataDirectory(),'custom.txt');

if(document.exists()) {
//file exists , do something with it
}

//Writing data to a file
var document = Ti.Filesystem.getFileStream(Ti.Filesystem.getApplicationDataDirectory(),'custom.txt');
document.open(Ti.Filesystem.MODE_WRITE);
document.write('New Data for File');
document.close();

For more information see the Filesystem documentation: Ti.Filesystem.File

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top