本文整理汇总了TypeScript中vs/base/node/pfs.fileExists函数的典型用法代码示例。如果您正苦于以下问题:TypeScript fileExists函数的具体用法?TypeScript fileExists怎么用?TypeScript fileExists使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fileExists函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: join
return quickOpenService.pick(picks, { placeHolder: nls.localize('openSnippet.pickLanguage', "Select Language for Snippet") }).then((language) => {
if (language) {
const snippetPath = join(environmentService.appSettingsHome, 'snippets', language.id + '.json');
return fileExists(snippetPath).then((success) => {
if (success) {
return openFile(snippetPath);
}
const defaultContent = [
'{',
'/*',
'\t// Place your snippets for ' + language.label + ' here. Each snippet is defined under a snippet name and has a prefix, body and ',
'\t// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:',
'\t// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the ',
'\t// same ids are connected.',
'\t// Example:',
'\t"Print to console": {',
'\t\t"prefix": "log",',
'\t\t"body": [',
'\t\t\t"console.log(\'$1\');",',
'\t\t\t"$2"',
'\t\t],',
'\t\t"description": "Log output to console"',
'\t}',
'*/',
'}'
].join('\n');
return writeFile(snippetPath, defaultContent).then(() => {
return openFile(snippetPath);
}, (err) => {
errors.onUnexpectedError(nls.localize('openSnippet.errorOnCreate', 'Unable to create {0}', snippetPath));
});
});
}
return TPromise.as(null);
});
示例2: getTerminalDefaultShellWindows
}
return _TERMINAL_DEFAULT_SHELL_UNIX_LIKE;
}
let _TERMINAL_DEFAULT_SHELL_WINDOWS: string = null;
export function getTerminalDefaultShellWindows(): string {
if (!_TERMINAL_DEFAULT_SHELL_WINDOWS) {
const isAtLeastWindows10 = platform.isWindows && parseFloat(os.release()) >= 10;
const is32ProcessOn64Windows = process.env.hasOwnProperty('PROCESSOR_ARCHITEW6432');
const powerShellPath = `${process.env.windir}\\${is32ProcessOn64Windows ? 'Sysnative' : 'System32'}\\WindowsPowerShell\\v1.0\\powershell.exe`;
_TERMINAL_DEFAULT_SHELL_WINDOWS = isAtLeastWindows10 ? powerShellPath : processes.getWindowsShell();
}
return _TERMINAL_DEFAULT_SHELL_WINDOWS;
}
if (platform.isLinux) {
const file = '/etc/os-release';
fileExists(file).then(exists => {
if (!exists) {
return;
}
readFile(file).then(b => {
const contents = b.toString();
if (contents.indexOf('NAME=Fedora') >= 0) {
isFedora = true;
}
});
});
}
export let isFedora = false;