本文整理汇总了TypeScript中vs/base/common/paths.isAbsolute函数的典型用法代码示例。如果您正苦于以下问题:TypeScript isAbsolute函数的具体用法?TypeScript isAbsolute怎么用?TypeScript isAbsolute使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了isAbsolute函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: getCwd
export function getCwd(shell: IShellLaunchConfig, root: Uri, configHelper: ITerminalConfigHelper): string {
if (shell.cwd) {
return shell.cwd;
}
let cwd: string;
// TODO: Handle non-existent customCwd
if (!shell.ignoreConfigurationCwd) {
// Evaluate custom cwd first
const customCwd = configHelper.config.cwd;
if (customCwd) {
if (paths.isAbsolute(customCwd)) {
cwd = customCwd;
} else if (root) {
cwd = paths.normalize(paths.join(root.fsPath, customCwd));
}
}
}
// If there was no custom cwd or it was relative with no workspace
if (!cwd) {
cwd = root ? root.fsPath : os.homedir();
}
return _sanitizeCwd(cwd);
}
开发者ID:ramesius,项目名称:vscode,代码行数:27,代码来源:terminalEnvironment.ts
示例2: dirname
export function dirname(resource: uri): uri {
const dirname = paths.dirname(resource.path);
if (resource.authority && dirname && !paths.isAbsolute(dirname)) {
return null; // If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character
}
return resource.with({
path: dirname
});
}
开发者ID:jinlongchen2018,项目名称:vscode,代码行数:10,代码来源:resources.ts
示例3: constructor
constructor(public raw: DebugProtocol.Source, sessionId: string) {
if (!raw) {
this.raw = { name: UNKNOWN_SOURCE_LABEL };
}
this.available = this.raw.name !== UNKNOWN_SOURCE_LABEL;
const path = this.raw.path || this.raw.name;
if (this.raw.sourceReference > 0) {
this.uri = uri.parse(`${DEBUG_SCHEME}:${encodeURIComponent(path)}?session=${encodeURIComponent(sessionId)}&ref=${this.raw.sourceReference}`);
} else {
if (paths.isAbsolute(path)) {
this.uri = uri.file(path); // path should better be absolute!
} else {
this.uri = uri.parse(path);
}
}
}
开发者ID:igolskyi,项目名称:vscode,代码行数:16,代码来源:debugSource.ts
示例4: constructor
constructor(public raw: DebugProtocol.Source, sessionId: string) {
let path: string;
if (!raw) {
this.raw = { name: UNKNOWN_SOURCE_LABEL };
this.available = false;
path = `${DEBUG_SCHEME}:${UNKNOWN_SOURCE_LABEL}`;
} else {
path = this.raw.path || this.raw.name;
this.available = true;
}
if (this.raw.sourceReference > 0) {
this.uri = uri.parse(`${DEBUG_SCHEME}:${encodeURIComponent(path)}?session=${encodeURIComponent(sessionId)}&ref=${this.raw.sourceReference}`);
} else {
if (paths.isAbsolute(path)) {
this.uri = uri.file(path);
} else {
// assume that path is a URI
this.uri = uri.parse(path);
}
}
}
开发者ID:ramesius,项目名称:vscode,代码行数:22,代码来源:debugSource.ts
示例5: getCwd
export function getCwd(shell: IShellLaunchConfig, root?: Uri, customCwd?: string): string {
if (shell.cwd) {
return (typeof shell.cwd === 'object') ? shell.cwd.path : shell.cwd;
}
let cwd: string | undefined;
// TODO: Handle non-existent customCwd
if (!shell.ignoreConfigurationCwd && customCwd) {
if (paths.isAbsolute(customCwd)) {
cwd = customCwd;
} else if (root) {
cwd = paths.normalize(paths.join(root.fsPath, customCwd));
}
}
// If there was no custom cwd or it was relative with no workspace
if (!cwd) {
cwd = root ? root.fsPath : os.homedir();
}
return _sanitizeCwd(cwd);
}
开发者ID:VishalMadhvani,项目名称:vscode,代码行数:23,代码来源:terminalEnvironment.ts
示例6: isAbsolutePath
export function isAbsolutePath(resource: URI): boolean {
return paths.isAbsolute(resource.path);
}
开发者ID:donaldpipowitch,项目名称:vscode,代码行数:3,代码来源:resources.ts
示例7: getAbsoluteGlob
export function getAbsoluteGlob(folder: string, key: string): string {
return paths.isAbsolute(key) ?
key :
path.join(folder, key);
}
开发者ID:DonJayamanne,项目名称:vscode,代码行数:5,代码来源:ripgrepFileSearch.ts
注:本文中的vs/base/common/paths.isAbsolute函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论