本文整理汇总了TypeScript中@jupyterlab/coreutils.PathExt.resolve方法的典型用法代码示例。如果您正苦于以下问题:TypeScript PathExt.resolve方法的具体用法?TypeScript PathExt.resolve怎么用?TypeScript PathExt.resolve使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@jupyterlab/coreutils.PathExt
的用法示例。
在下文中一共展示了PathExt.resolve方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: _evtDrop
/**
* Handle the `'p-drop'` event for the widget.
*/
private _evtDrop(event: IDragEvent): void {
event.preventDefault();
event.stopPropagation();
if (event.proposedAction === 'none') {
event.dropAction = 'none';
return;
}
if (!event.mimeData.hasData(CONTENTS_MIME)) {
return;
}
event.dropAction = event.proposedAction;
let target = event.target as HTMLElement;
while (target && target.parentElement) {
if (target.classList.contains(DROP_TARGET_CLASS)) {
target.classList.remove(DROP_TARGET_CLASS);
break;
}
target = target.parentElement;
}
// Get the path based on the target node.
let index = ArrayExt.findFirstIndex(this._crumbs, node => node === target);
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<any>[] = [];
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));
}
Promise.all(promises).catch(err => {
showErrorMessage('Move Error', err);
});
}
示例2: it
it('should resolve a sequence of paths to an absolute path on the server', () => {
let path = PathExt.resolve('var/lib', '../', 'file/');
expect(path).to.equal('var/file');
});
示例3: it
it('should resolve a sequence of paths to an absolute path on the server', () => {
const path = PathExt.resolve('var/src', '../', 'file/');
expect(path.indexOf('var/file')).to.not.equal(-1);
});