src/vs/base/common/labels.ts/getPathLabel
export function getPathLabel(resource: URI | string, userHomeProvider?: IUserHomeProvider, rootProvider?: IWorkspaceFolderProvider): string {
	if (typeof resource === 'string') {
		resource = URI.file(resource);
	}

	// return early if we can resolve a relative path label from the root
	if (rootProvider) {
		const baseResource = rootProvider.getWorkspaceFolder(resource);
		if (baseResource) {
			const hasMultipleRoots = rootProvider.getWorkspace().folders.length > 1;

			let pathLabel: string;
			if (isEqual(baseResource.uri, resource)) {
				pathLabel = ''; // no label if paths are identical
			} else {
				pathLabel = relativePath(baseResource.uri, resource)!;
			}

			if (hasMultipleRoots) {
				const rootName = baseResource.name ? baseResource.name : basename(baseResource.uri);
				pathLabel = pathLabel ? (rootName + ' • ' + pathLabel) : rootName; // always show root basename if there are multiple
			}

			return pathLabel;
		}
	}

	// return if the resource is neither file:// nor untitled:// and no baseResource was provided
	if (resource.scheme !== Schemas.file && resource.scheme !== Schemas.untitled) {
		return resource.with({ query: null, fragment: null }).toString(true);
	}

	// convert c:\something => C:\something
	if (hasDriveLetter(resource.fsPath)) {
		return normalize(normalizeDriveLetter(resource.fsPath));
	}

	// normalize and tildify (macOS, Linux only)
	let res = normalize(resource.fsPath);
	if (!isWindows && userHomeProvider?.userHome) {
		res = tildify(res, userHomeProvider.userHome.fsPath);
	}

	return res;
}