_realDestinationPath = _realDestinationPath + _realOriginalPath.split('/').pop();
}
+ if (!args.overwrite) {
+ var resultNewPath = native_.callSync('File_statSync', {location: _realDestinationPath});
+ if (native_.isSuccess(resultNewPath)) {
+ setTimeout(function() {
+ native_.callIfPossible(args.onerror,
+ new WebAPIException(WebAPIException.IO_ERR, 'Overwrite is not allowed'));
+ }, 0);
+ return;
+ }
+ }
+
+ if (!commonFS_.f_isSubDir(_realOriginalPath, this.fullPath)) {
+ var m1 = 'Source file should be subdirectory of: ' + this.fullPath;
+ setTimeout(function() {
+ native_.callIfPossible(args.onerror,
+ new WebAPIException(WebAPIException.INVALID_VALUES_ERR, m1));
+ }, 0);
+ return;
+ }
+
+ if (!commonFS_.isLocationAllowed(_realDestinationPath)) {
+ var m2 = 'Destination is read only folder: ' + this.fullPath;
+ setTimeout(function() {
+ native_.callIfPossible(args.onerror,
+ new WebAPIException(WebAPIException.INVALID_VALUES_ERR, m2));
+ }, 0);
+ return;
+ }
+
var data = {
originFilePath: _realOriginalPath,
destinationFilePath: _realDestinationPath,