Skip to content

Commit

Permalink
Ensure directories.user exists.
Browse files Browse the repository at this point in the history
Closes arduino#1445

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
  • Loading branch information
Akos Kitta authored and kittaakos committed Sep 21, 2022
1 parent b3ab5cb commit 6983c5b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion arduino-ide-extension/src/node/config-service-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ export class ConfigServiceImpl
this.loadCliConfig().then(async (cliConfig) => {
this.cliConfig = cliConfig;
if (this.cliConfig) {
const config = await this.mapCliConfigToAppConfig(this.cliConfig);
const [config] = await Promise.all([
this.mapCliConfigToAppConfig(this.cliConfig),
this.ensureUserDirExists(this.cliConfig),
]);
if (config) {
this.config = config;
this.ready.resolve();
Expand Down Expand Up @@ -263,4 +266,11 @@ export class ConfigServiceImpl
grpc.credentials.createInsecure()
) as SettingsServiceClient;
}

// #1445
private async ensureUserDirExists(
cliConfig: DefaultCliConfig
): Promise<void> {
await fs.mkdir(cliConfig.directories.user, { recursive: true });
}
}

0 comments on commit 6983c5b

Please sign in to comment.