Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/ios/CDVLocalFilesystem.m
Original file line number Diff line number Diff line change
Expand Up @@ -551,8 +551,13 @@ - (void)copyFileToURL:(CDVFilesystemURL *)destURL withName:(NSString *)newName f
// can't copy dir into self
errCode = INVALID_MODIFICATION_ERR;
} else if (bNewExists) {
// the full destination should NOT already exist if a copy
errCode = PATH_EXISTS_ERR;
// first try to remove the existing file
bSuccess = [fileMgr removeItemAtPath:newFileSystemPath error:&error];

if (bSuccess) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What should be done in the case removal of the item fails?

// then copy the new one
bSuccess = [fileMgr copyItemAtPath:srcFullPath toPath:newFileSystemPath error:&error];
}
} else {
bSuccess = [fileMgr copyItemAtPath:srcFullPath toPath:newFileSystemPath error:&error];
}
Expand Down