将文件从应用程序目录复制到用户桌面后出现错误#3003
我有一个相当简单的代码来将 sqlite 数据库复制到用户的桌面目录:
function copyFile(e:MouseEvent):void
{
var dbFile = new File(File.applicationDirectory.nativePath);
dbFile = dbFile.resolvePath("userDB.sqlite");
trace(dbFile); // [object File]
//
var destination = File.desktopDirectory;
destination = destination.resolvePath("res");
trace(destination);// [object File]
//
dbFile.addEventListener(Event.COMPLETE, fileMoveCompleteHandler);
dbFile.addEventListener(IOErrorEvent.IO_ERROR, fileMoveIOErrorEventHandler);
dbFile.copyTo(destination, true);
}
function fileMoveCompleteHandler(event)
{
trace(event.target);
}
function fileMoveIOErrorEventHandler(event)
{
trace("I/O Error.");
}
//
btn.addEventListener(MouseEvent.MOUSE_DOWN,copyFile);
文件存在并且目录“res”存在于用户的桌面上。不幸的是我收到这个错误:
Error: Error #3003: File or directory does not exist.
at flash.filesystem::File/copyTo()
at dbcopy_fla::MainTimeline/copyFile()[dbcopy_fla.MainTimeline::frame1:48]
我做错了什么?
I've this fairly easy code to copy a sqlite db to the desktop directory of the user:
function copyFile(e:MouseEvent):void
{
var dbFile = new File(File.applicationDirectory.nativePath);
dbFile = dbFile.resolvePath("userDB.sqlite");
trace(dbFile); // [object File]
//
var destination = File.desktopDirectory;
destination = destination.resolvePath("res");
trace(destination);// [object File]
//
dbFile.addEventListener(Event.COMPLETE, fileMoveCompleteHandler);
dbFile.addEventListener(IOErrorEvent.IO_ERROR, fileMoveIOErrorEventHandler);
dbFile.copyTo(destination, true);
}
function fileMoveCompleteHandler(event)
{
trace(event.target);
}
function fileMoveIOErrorEventHandler(event)
{
trace("I/O Error.");
}
//
btn.addEventListener(MouseEvent.MOUSE_DOWN,copyFile);
The file exists and the directory 'res' exists on the user's desktop. Unfortunately I get this error:
Error: Error #3003: File or directory does not exist.
at flash.filesystem::File/copyTo()
at dbcopy_fla::MainTimeline/copyFile()[dbcopy_fla.MainTimeline::frame1:48]
What am I doing wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论