src/vs/platform/userDataProfile/electron-main/userDataProfile.ts/UserDataProfilesMainService/createProfile
class UserDataProfilesMainService:	override async createProfile(profile: IUserDataProfile, workspaceIdentifier?: WorkspaceIdentifier): Promise<IUserDataProfile> {
		if (!this.enabled) {
			throw new Error(`Settings Profiles are disabled. Enable them via the '${PROFILES_ENABLEMENT_CONFIG}' setting.`);
		}
		profile = reviveProfile(profile, this.profilesHome.scheme);
		if (this.getStoredProfiles().some(p => p.name === profile.name)) {
			throw new Error(`Profile with name ${profile.name} already exists`);
		}

		if (!(await this.fileService.exists(this.profilesHome))) {
			await this.fileService.createFolder(this.profilesHome);
		}

		const joiners: Promise<void>[] = [];
		this._onWillCreateProfile.fire({
			profile,
			join(promise) {
				joiners.push(promise);
			}
		});
		await Promises.settled(joiners);

		this.updateProfiles([profile], []);

		if (workspaceIdentifier) {
			await this.setProfileForWorkspace(profile, workspaceIdentifier);
		}

		return this.profiles.find(p => this.uriIdentityService.extUri.isEqual(p.location, profile.location))!;
	}