ActionScript 3 检查当前文件和文件夹是否存在
ActionScripts 3 check current file and folder exsist
如何获取已编译的 AIR 可执行应用程序的 当前路径 并检查 文件并且 文件夹 存在于同一位置?
我尝试使用此代码,但它不起作用:
var File1:File = File.applicationDirectory.resolvePath('APPAR-NC.exe');
if (File1.exists)
{
trace("The file exists.");
}
else
{
trace("The file does not exists.")
};
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/filesystem/File.html
// The folder where your app is installed to.
File.applicationDirectory:File
// The same result as above.
new File("app://")
// The same folder as a system path string.
File.applicationDirectory.nativePath:String
// Returns true if file/folder, represented by the File object, exists.
File.exists:Boolean
// Returns true if the path, represented by the File object, is a folder rather than a file.
File.isDirectory:Boolean
只需对您的代码稍作改动。
var File1:File = File.applicationDirectory.resolvePath("APPAR-NC.exe");
if (File1.exists)
{
if(File1.isDirectory)
trace("The folder exists.");
else
trace("The file exists.");
}
else
{
trace("The file does not exists.")
};
如何获取已编译的 AIR 可执行应用程序的 当前路径 并检查 文件并且 文件夹 存在于同一位置?
我尝试使用此代码,但它不起作用:
var File1:File = File.applicationDirectory.resolvePath('APPAR-NC.exe');
if (File1.exists)
{
trace("The file exists.");
}
else
{
trace("The file does not exists.")
};
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/filesystem/File.html
// The folder where your app is installed to.
File.applicationDirectory:File
// The same result as above.
new File("app://")
// The same folder as a system path string.
File.applicationDirectory.nativePath:String
// Returns true if file/folder, represented by the File object, exists.
File.exists:Boolean
// Returns true if the path, represented by the File object, is a folder rather than a file.
File.isDirectory:Boolean
只需对您的代码稍作改动。
var File1:File = File.applicationDirectory.resolvePath("APPAR-NC.exe");
if (File1.exists)
{
if(File1.isDirectory)
trace("The folder exists.");
else
trace("The file exists.");
}
else
{
trace("The file does not exists.")
};