src/vs/platform/terminal/node/terminalProfiles.ts/transformToTerminalProfiles
async function transformToTerminalProfiles(
	entries: IterableIterator<[string, ITerminalProfileObject]>,
	defaultProfileName: string | undefined,
	fsProvider: IFsProvider,
	logService?: ILogService,
	variableResolver?: (text: string[]) => Promise<string[]>
): Promise<ITerminalProfile[]> {
	const resultProfiles: ITerminalProfile[] = [];
	for (const [profileName, profile] of entries) {
		if (profile === null) { continue; }
		let originalPaths: string[];
		let args: string[] | string | undefined;
		let icon: ThemeIcon | URI | { light: URI, dark: URI } | undefined = undefined;
		if ('source' in profile) {
			const source = profileSources?.get(profile.source);
			if (!source) {
				continue;
			}
			originalPaths = source.paths;

			// if there are configured args, override the default ones
			args = profile.args || source.args;
			if (profile.icon) {
				icon = validateIcon(profile.icon);
			} else if (source.icon) {
				icon = source.icon;
			}
		} else {
			originalPaths = Array.isArray(profile.path) ? profile.path : [profile.path];
			args = isWindows ? profile.args : Array.isArray(profile.args) ? profile.args : undefined;
			icon = validateIcon(profile.icon) || undefined;
		}

		const paths = (await variableResolver?.(originalPaths)) || originalPaths.slice();
		const validatedProfile = await validateProfilePaths(profileName, defaultProfileName, paths, fsProvider, args, profile.env, profile.overrideName, profile.isAutoDetected, logService);
		if (validatedProfile) {
			validatedProfile.isAutoDetected = profile.isAutoDetected;
			validatedProfile.icon = icon;
			validatedProfile.color = profile.color;
			resultProfiles.push(validatedProfile);
		} else {
			logService?.trace('profile not validated', profileName, originalPaths);
		}
	}
	return resultProfiles;
}