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


TypeScript paths.isEqualOrParent函數代碼示例

本文整理匯總了TypeScript中vs/base/common/paths.isEqualOrParent函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript isEqualOrParent函數的具體用法?TypeScript isEqualOrParent怎麽用?TypeScript isEqualOrParent使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了isEqualOrParent函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: isEqualOrParent

export function isEqualOrParent(base: URI, parentCandidate: URI, ignoreCase = hasToIgnoreCase(base)): boolean {
	if (base.scheme === parentCandidate.scheme) {
		if (base.scheme === Schemas.file) {
			return paths.isEqualOrParent(fsPath(base), fsPath(parentCandidate), ignoreCase);
		}
		if (isEqualAuthority(base.authority, parentCandidate.authority, ignoreCase)) {
			return paths.isEqualOrParent(base.path, parentCandidate.path, ignoreCase, '/');
		}
	}
	return false;
}
開發者ID:donaldpipowitch,項目名稱:vscode,代碼行數:11,代碼來源:resources.ts

示例2: isEqualOrParent

export function isEqualOrParent(resource: uri, candidate: uri, ignoreCase?: boolean): boolean {
	if (resource.scheme === candidate.scheme && resource.authority === candidate.authority) {
		if (resource.scheme === 'file') {
			return paths.isEqualOrParent(resource.fsPath, candidate.fsPath, ignoreCase);
		}

		return paths.isEqualOrParent(resource.path, candidate.path, ignoreCase);
	}

	return false;
}
開發者ID:jinlongchen2018,項目名稱:vscode,代碼行數:11,代碼來源:resources.ts

示例3: tildify

export function tildify(path: string, userHome: string): string {
	if (path && (platform.isMacintosh || platform.isLinux) && isEqualOrParent(path, userHome, !platform.isLinux /* ignorecase */)) {
		path = `~${path.substr(userHome.length)}`;
	}

	return path;
}
開發者ID:Chan-PH,項目名稱:vscode,代碼行數:7,代碼來源:labels.ts

示例4: massageFolderPathForWorkspace

export function massageFolderPathForWorkspace(absoluteFolderPath: string, targetConfigFolder: string, existingFolders: IStoredWorkspaceFolder[]): string {
	const useSlashesForPath = shouldUseSlashForPath(existingFolders);

	// Convert path to relative path if the target config folder
	// is a parent of the path.
	if (isEqualOrParent(absoluteFolderPath, targetConfigFolder, !isLinux)) {
		absoluteFolderPath = relative(targetConfigFolder, absoluteFolderPath) || '.';
	}

	// Windows gets special treatment:
	// - normalize all paths to get nice casing of drive letters
	// - convert to slashes if we want to use slashes for paths
	if (isWindows) {
		if (isAbsolute(absoluteFolderPath)) {
			if (useSlashesForPath) {
				absoluteFolderPath = normalize(absoluteFolderPath, false /* do not use OS path separator */);
			}

			absoluteFolderPath = normalizeDriveLetter(absoluteFolderPath);
		} else if (useSlashesForPath) {
			absoluteFolderPath = absoluteFolderPath.replace(/[\\]/g, SLASH);
		}
	}

	return absoluteFolderPath;
}
開發者ID:AlexxNica,項目名稱:sqlopsstudio,代碼行數:26,代碼來源:workspaces.ts

示例5: isEqualOrParent

export function isEqualOrParent(first: uri, second: uri, ignoreCase?: boolean): boolean {
	if (first.scheme === second.scheme && first.authority === second.authority) {
		return paths.isEqualOrParent(first.fsPath, second.fsPath, ignoreCase);
	}

	return false;
}
開發者ID:AlexxNica,項目名稱:sqlopsstudio,代碼行數:7,代碼來源:resources.ts

示例6:

	const windowsOnFilePath = windows.filter(window => typeof window.openedFolderPath === 'string' && paths.isEqualOrParent(filePath, window.openedFolderPath, !platform.isLinux /* ignorecase */));
開發者ID:naturtle,項目名稱:vscode,代碼行數:1,代碼來源:windowsFinder.ts

示例7:

				.forEach(otherRootFolder => {
					// Exclude nested root folders
					if (isEqualOrParent(otherRootFolder, folderQuery.folder)) {
						folderExcludeExpression[path.relative(folderQuery.folder, otherRootFolder)] = true;
					}
				});
開發者ID:naturtle,項目名稱:vscode,代碼行數:6,代碼來源:fileSearch.ts

示例8:

	const containers = windows.filter(window => typeof window.openedWorkspacePath === 'string' && paths.isEqualOrParent(filePath, window.openedWorkspacePath));
開發者ID:yuit,項目名稱:vscode,代碼行數:1,代碼來源:windowsUtils.ts

示例9:

		if (resolvedWorkspace && resolvedWorkspace.folders.some(folder => paths.isEqualOrParent(filePath, folder.path, !platform.isLinux /* ignorecase */))) {
開發者ID:armanio123,項目名稱:vscode,代碼行數:1,代碼來源:windowsFinder.ts

示例10: test

	test('isEqualOrParent (ignorecase)', function () {

		// same assertions apply as with isEqual()
		testIsEqual(isEqualOrParent);

		if (isWindows) {
			assert(isEqualOrParent('c:\\some\\path', 'c:\\', true));
			assert(isEqualOrParent('c:\\some\\path', 'c:\\some', true));
			assert(isEqualOrParent('c:\\some\\path', 'c:\\some\\', true));
			assert(isEqualOrParent('c:\\someöäü\\path', 'c:\\someöäü', true));
			assert(isEqualOrParent('c:\\someöäü\\path', 'c:\\someöäü\\', true));
			assert(isEqualOrParent('c:\\foo\\bar\\test.ts', 'c:\\foo\\bar', true));
			assert(isEqualOrParent('c:\\foo\\bar\\test.ts', 'c:\\foo\\bar\\', true));
			assert(isEqualOrParent('c:\\some\\path', 'c:\\some\\path', true));
			assert(isEqualOrParent('c:\\foo\\bar\\test.ts', 'c:\\foo\\bar\\test.ts', true));

			assert(isEqualOrParent('c:\\some\\path', 'C:\\', true));
			assert(isEqualOrParent('c:\\some\\path', 'c:\\SOME', true));
			assert(isEqualOrParent('c:\\some\\path', 'c:\\SOME\\', true));

			assert(!isEqualOrParent('c:\\some\\path', 'd:\\', true));
			assert(!isEqualOrParent('c:\\some\\path', 'd:\\some\\path', true));
			assert(!isEqualOrParent('c:\\foo\\bar\\test.ts', 'c:\\foo\\barr', true));
			assert(!isEqualOrParent('c:\\foo\\bar\\test.ts', 'c:\\foo\\bar\\test', true));
			assert(!isEqualOrParent('c:\\foo\\bar\\test.ts', 'c:\\foo\\bar\\test.', true));
			assert(!isEqualOrParent('c:\\foo\\bar\\test.ts', 'c:\\foo\\BAR\\test.', true));
		}

		if (isMacintosh || isLinux) {
			assert(isEqualOrParent('/some/path', '/', true));
			assert(isEqualOrParent('/some/path', '/some', true));
			assert(isEqualOrParent('/some/path', '/some/', true));
			assert(isEqualOrParent('/someöäü/path', '/someöäü', true));
			assert(isEqualOrParent('/someöäü/path', '/someöäü/', true));
			assert(isEqualOrParent('/foo/bar/test.ts', '/foo/bar', true));
			assert(isEqualOrParent('/foo/bar/test.ts', '/foo/bar/', true));
			assert(isEqualOrParent('/some/path', '/some/path', true));

			assert(isEqualOrParent('/some/path', '/SOME', true));
			assert(isEqualOrParent('/some/path', '/SOME/', true));
			assert(isEqualOrParent('/someöäü/path', '/SOMEÖÄÜ', true));
			assert(isEqualOrParent('/someöäü/path', '/SOMEÖÄÜ/', true));

			assert(!isEqualOrParent('/foo/bar/test.ts', '/foo/barr', true));
			assert(!isEqualOrParent('/foo/bar/test.ts', '/foo/bar/test', true));
			assert(!isEqualOrParent('foo/bar/test.ts', 'foo/bar/test.', true));
			assert(!isEqualOrParent('foo/bar/test.ts', 'foo/BAR/test.', true));
		}
	});
開發者ID:burhandodhy,項目名稱:azuredatastudio,代碼行數:49,代碼來源:files.test.ts


注:本文中的vs/base/common/paths.isEqualOrParent函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。