當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript paths.isAbsolute函數代碼示例

本文整理匯總了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;未經允許,請勿轉載。