This content has been marked as final.
Show 2 replies
-
1. Re: File.copyTo(desktop, true) wiped my desktop
chris.campbell Mar 29, 2013 1:28 PM (in response to Damon Edwards)Unfortunately I think you specified the desktop directory as the file object to overwrite in the copyTo method. See the red text in the docs below.
newLocation The target location of the new file. Note that this File object specifies the resulting (copied) file or directory, not the path to the containing directory.
Instead, I think what you wanted to write was:
var userDirectory = File.userDirectory;
var desktopDirectory = File.desktopDirectory;
var fileToCopy = userDirectory.resolvePath('file.ext');
var destinationFile:File = desktopDirectory.resolvePath("file.ext");
fileToCopy.copyTo(destinationFile, true);
- It does seem to me like a file shouldn't be able to overwrite a folder. This is the behavior on Windows. I'd recommend opening a new bug on that over at bugbase.adobe.com. Sorry you had to go through this, I unfortunately don't know of a way to revert this on the Mac.
- It does seem to me like a file shouldn't be able to overwrite a folder. This is the behavior on Windows. I'd recommend opening a new bug on that over at bugbase.adobe.com. Sorry you had to go through this, I unfortunately don't know of a way to revert this on the Mac.
-
2. Re: File.copyTo(desktop, true) wiped my desktop
Damon Edwards Mar 29, 2013 1:58 PM (in response to chris.campbell)Well that's what I get for not reading the docs. Thanks Chris, I'll file the bug.



