本文整理匯總了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;