Adobe Air how to check if folder exists?

时光毁灭记忆、已成空白 提交于 2019-12-11 12:54:57

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!