in src/app/files/files.service.ts [610:643]
private uploadFileSystemDirectoryEntry(fsDirectory: FileSystemDirectoryEntry, to: ApiFile): Promise<any> {
let dir = new ApiFile();
dir.type = ApiFileType.Directory;
dir.name = fsDirectory.name;
return this.createInternal(dir, to)
.catch(e => {
if (e.status != 409) {
throw e;
}
this._notificationService.clearWarnings();
return this.getByPhysicalPath(to.physical_path + '\\' + dir.name);
})
.then(newDir => {
return this.getChildItems(fsDirectory)
.then(entries => {
return this.uploadItemsInternal(entries, newDir)
.then(uploadItems => {
return this.getFileSystemEntryMetadata(fsDirectory)
.then(metadata => {
// Update LastModified
return this.update(newDir, { last_modified: metadata.modificationTime });
});
});
})
.catch(e => {
this.handleError(e);
if (newDir) {
this._notificationService.warn("An error occured while uploading " + dir.physical_path);
}
throw e;
});
});
}