Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
} else {
event.dropAction = event.proposedAction;
}
for (let path of paths) {
let localPath = manager.services.contents.localPath(path);
let name = PathExt.basename(localPath);
let newPath = PathExt.join(basePath, name);
// Skip files that are not moving.
if (newPath === path) {
continue;
}
if (event.dropAction === 'copy') {
promises.push(manager.copy(path, basePath));
} else {
promises.push(renameFile(manager, path, newPath));
}
}
Promise.all(promises).catch(error => {
void showErrorMessage('Error while copying/moving files', error);
});
}
if (index === -1) {
return;
}
const model = this._model;
const path = PathExt.resolve(model.path, BREAD_CRUMB_PATHS[index]);
const manager = model.manager;
// Move all of the items.
let promises: Promise[] = [];
let oldPaths = event.mimeData.getData(CONTENTS_MIME) as string[];
for (let oldPath of oldPaths) {
let localOldPath = manager.services.contents.localPath(oldPath);
let name = PathExt.basename(localOldPath);
let newPath = PathExt.join(path, name);
promises.push(renameFile(manager, oldPath, newPath));
}
void Promise.all(promises).catch(err => {
return showErrorMessage('Move Error', err);
});
}
`and cannot include "/", "\\", or ":"`
)
);
this._inRename = false;
return original;
}
if (this.isDisposed) {
this._inRename = false;
throw new Error('File browser is disposed.');
}
const manager = this._manager;
const oldPath = PathExt.join(this._model.path, original);
const newPath = PathExt.join(this._model.path, newName);
const promise = renameFile(manager, oldPath, newPath);
return promise
.catch(error => {
if (error !== 'File not renamed') {
showErrorMessage('Rename Error', error);
}
this._inRename = false;
return original;
})
.then(() => {
if (this.isDisposed) {
this._inRename = false;
throw new Error('File browser is disposed.');
}
if (this._inRename) {
// No need to catch because `newName` will always exit.
this.selectItemByName(newName);
} else {
event.dropAction = event.proposedAction;
}
for (let path of paths) {
let localPath = manager.services.contents.localPath(path);
let name = PathExt.basename(localPath);
let newPath = PathExt.join(basePath, name);
// Skip files that are not moving.
if (newPath === path) {
continue;
}
if (event.dropAction === 'copy') {
promises.push(manager.copy(path, basePath));
} else {
promises.push(renameFile(manager, path, newPath));
}
}
Promise.all(promises).catch(error => {
showErrorMessage('Error while copying/moving files', error);
});
}
if (items[index].type === 'directory') {
basePath = PathExt.join(basePath, items[index].name);
}
const manager = this._manager;
// Handle the items.
const promises: Promise[] = [];
const paths = event.mimeData.getData(CONTENTS_MIME) as string[];
for (let path of paths) {
let name = PathExt.basename(path);
let newPath = PathExt.join(basePath, name);
// Skip files that are not moving.
if (newPath === path) {
continue;
}
promises.push(renameFile(manager, path, newPath));
}
Promise.all(promises).catch(error => {
utils.showErrorMessage('Move Error', error);
});
}
`and cannot include "/", "\\", or ":"`
)
);
this._inRename = false;
return original;
}
if (this.isDisposed) {
this._inRename = false;
throw new Error('File browser is disposed.');
}
const manager = this._manager;
const oldPath = PathExt.join(this._model.path, original);
const newPath = PathExt.join(this._model.path, newName);
const promise = renameFile(manager, oldPath, newPath);
return promise
.catch(error => {
if (error !== 'File not renamed') {
void showErrorMessage('Rename Error', error);
}
this._inRename = false;
return original;
})
.then(() => {
if (this.isDisposed) {
this._inRename = false;
throw new Error('File browser is disposed.');
}
if (this._inRename) {
// No need to catch because `newName` will always exit.
void this.selectItemByName(newName);
return Private.doRename(nameNode, this._editNode).then(newName => {
if (newName === original) {
this._inRename = false;
return original;
}
if (this.isDisposed) {
this._inRename = false;
return;
}
const manager = this._manager;
const oldPath = PathExt.join(this._model.path, original);
const newPath = PathExt.join(this._model.path, newName);
const promise = renameFile(manager, oldPath, newPath);
return promise.catch(error => {
utils.showErrorMessage('Rename Error', error);
this._inRename = false;
return original;
}).then(() => {
if (this.isDisposed) {
this._inRename = false;
return;
}
this.selectItemByName(newName);
this._inRename = false;
return newName;
});
});
}