问题
Adobe Air (2.0) how to check if folder exists? (like folder C:\Program Files (x86) on windows) (code example needed, please)
回答1:
I think you can use the following functions of the File class:
var folder:File = File.userDirectory.resolvePath(folderPath);
folder.isDirectory;
The isDirectory property will return a Boolean depending on whether or not that folder exists. Hope that helps,
debu
回答2:
import flash.filesystem.File;
var tempFold:File = File.userDirectory.resolvePath("FolderPath");
if(tempFold.exists)
{
trace("The directory exists.");
}
else
{
trace("The directory does not exists.");
}
来源:https://stackoverflow.com/questions/2869773/adobe-air-how-to-check-if-folder-exists