当前位置: 首页>>代码示例>>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;未经允许,请勿转载。