本文整理汇总了TypeScript中vs/workbench/services/files/electron-browser/fileService.FileService.resolveFile方法的典型用法代码示例。如果您正苦于以下问题:TypeScript FileService.resolveFile方法的具体用法?TypeScript FileService.resolveFile怎么用?TypeScript FileService.resolveFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vs/workbench/services/files/electron-browser/fileService.FileService
的用法示例。
在下文中一共展示了FileService.resolveFile方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: test
test('resolveFile', function () {
return service.resolveFile(uri.file(testDir), { resolveTo: [uri.file(path.join(testDir, 'deep'))] }).then(r => {
assert.equal(r.children.length, 8);
const deep = utils.getByName(r, 'deep');
assert.equal(deep.children.length, 4);
});
});
示例2: test
test('deleteFolder (non recursive)', function () {
const resource = uri.file(path.join(testDir, 'deep'));
return service.resolveFile(resource).then(source => {
return service.del(source.resource).then(() => {
return Promise.reject(new Error('Unexpected'));
}, error => {
return Promise.resolve(true);
});
});
});
示例3:
return service.moveFile(source.resource, uri.file(path.join(path.dirname(source.resource.fsPath), 'CONWAY.js'))).then(renamed => {
assert.equal(fs.existsSync(renamed.resource.fsPath), true);
assert.ok(fs.readdirSync(testDir).some(f => f === 'CONWAY.js'));
return service.resolveFile(uri.file(path.join(testDir, 'deep', 'conway.js'))).then(source => {
const targetParent = uri.file(testDir);
const target = targetParent.with({ path: path.posix.join(targetParent.path, path.posix.basename(source.resource.path)) });
return service.copyFile(source.resource, target, true).then(res => { // CONWAY.js => conway.js
assert.equal(fs.existsSync(res.resource.fsPath), true);
assert.ok(fs.readdirSync(testDir).some(f => f === 'conway.js'));
});
});
});