本文整理匯總了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);
}
示例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
});
}
示例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);
}
}
}
示例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);
}
}
}
示例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);
}
示例6: isAbsolutePath
export function isAbsolutePath(resource: URI): boolean {
return paths.isAbsolute(resource.path);
}
示例7: getAbsoluteGlob
export function getAbsoluteGlob(folder: string, key: string): string {
return paths.isAbsolute(key) ?
key :
path.join(folder, key);
}