I would suspect that this is a security restriction -
I would not be surprised if you could only WRITE to application storage, my documents, or the desktop.....
* File.applicationStorageDirectory —a storage directory unique to each installed AIR application
* File.applicationDirectory —the read-only directory where the application is installed (along with any installed assets)
* File.desktopDirectory —the user's desktop directory
* File.documentsDirectory —the user's documents directory
* File.userDirectory —the user directory
does it work to copy the file to you your desktop, or documents directory? If yes, but not to C:\Program Files, it is probably because you (actually the flex app) are not authorized as an administrator on your machine, and thus do not have write access above your user directory. you'd have to change permissions on the device. if you are looking to save out a file or something, try using the File.browseForDirectory method to identify a path.
Well it didn't seem like it was a security error. I wasn't able to copy to C:\Program Files\, but i was able to copy to C:\Program Files\test\. However... if i add any other files or directories to the "test" directory. Pretty much i've come to the conclusion that the copyTo() function does not work on directories that are not empty.
I was using the browseToDirectory() method to have the user select where they wanted to copy to. My solution is just just always create a subdirectory to whereever they've selected so i know it's a new directory w/ no other files for folders in it.
Still doesn't make sence to me but i can't waste anymore time on this. Thanks for the help guys!
This is because your destination folder is read-only.
It is because copyTo is copying file(or folder) to exact where it pointing to.
This concept might be confusing.
The point is "copyTo" is literally copyTo where the File destination pointing to. IT IS NOT "copyInto".
So, if you try to copy a folder to folder, target_folder is being asked 'replaced' into source folder's name.
If target_folder is in use (of course it is IN USE by current process, so can't be replaced), you will have the error msg.
So, it is recommended you make more explicit target destination, such as,
source_folder.copyTo (temp_folder.resolvePath(source_folder.name)); OR