diff --git a/shell/browser/api/electron_api_app.cc b/shell/browser/api/electron_api_app.cc index 73db1e756f885..3bdbf30ee8f15 100644 --- a/shell/browser/api/electron_api_app.cc +++ b/shell/browser/api/electron_api_app.cc @@ -1148,6 +1148,8 @@ bool App::RequestSingleInstanceLock(gin::Arguments* args) { base::FilePath user_dir; base::PathService::Get(chrome::DIR_USER_DATA, &user_dir); + // The user_dir may have not been created yet. + base::CreateDirectoryAndGetError(user_dir, nullptr); auto cb = base::BindRepeating(&App::OnSecondInstance, base::Unretained(this)); auto wrapped_cb = base::BindRepeating(NotificationCallbackWrapper, cb); diff --git a/spec-main/api-app-spec.ts b/spec-main/api-app-spec.ts index 98b7b8ac2778f..0389b70931a07 100644 --- a/spec-main/api-app-spec.ts +++ b/spec-main/api-app-spec.ts @@ -228,7 +228,7 @@ describe('app module', () => { expect(code1).to.equal(0); }); - it.only('returns true when setting non-existent user data folder', async function () { + it('returns true when setting non-existent user data folder', async function () { const appPath = path.join(fixturesPath, 'api', 'singleton-userdata'); const instance = cp.spawn(process.execPath, [appPath]); const [code] = await emittedOnce(instance, 'exit');