mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-08 17:19:48 +01:00
Pull common unix/win parts into shared function
This commit is contained in:
@@ -57,13 +57,7 @@ async function detectAvailableWindowsProfiles(quickLaunchOnly: boolean, statProv
|
||||
);
|
||||
}
|
||||
|
||||
for (const [profileName, value] of Object.entries(configProfiles || {})) {
|
||||
if (value === null) {
|
||||
detectedProfiles.delete(profileName);
|
||||
} else {
|
||||
detectedProfiles.set(profileName, value);
|
||||
}
|
||||
}
|
||||
applyConfigProfilesToMap(configProfiles, detectedProfiles);
|
||||
|
||||
const resultProfiles: ITerminalProfile[] = await transformToTerminalProfiles(detectedProfiles.entries(), statProvider, logService, variableResolver, workspaceFolder);
|
||||
|
||||
@@ -203,17 +197,24 @@ async function detectAvailableUnixProfiles(statProvider: IStatProvider, logServi
|
||||
}
|
||||
}
|
||||
|
||||
for (const [profileName, value] of Object.entries(configProfiles || {})) {
|
||||
if (value === null) {
|
||||
detectedProfiles.delete(profileName);
|
||||
} else {
|
||||
detectedProfiles.set(profileName, value);
|
||||
}
|
||||
}
|
||||
applyConfigProfilesToMap(configProfiles, detectedProfiles);
|
||||
|
||||
return await transformToTerminalProfiles(detectedProfiles.entries(), statProvider, logService, variableResolver, workspaceFolder);
|
||||
}
|
||||
|
||||
function applyConfigProfilesToMap(configProfiles: { [key: string]: ITerminalProfileObject } | undefined, profilesMap: Map<string, ITerminalProfileObject>) {
|
||||
if (!configProfiles) {
|
||||
return;
|
||||
}
|
||||
for (const [profileName, value] of Object.entries(configProfiles)) {
|
||||
if (value === null) {
|
||||
profilesMap.delete(profileName);
|
||||
} else {
|
||||
profilesMap.set(profileName, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function validateProfilePaths(label: string, potentialPaths: string[], statProvider: IStatProvider, args?: string[] | string, logService?: ILogService): Promise<ITerminalProfile | undefined> {
|
||||
if (potentialPaths.length === 0) {
|
||||
return Promise.resolve(undefined);
|
||||
|
||||
Reference in New Issue
Block a user