From e178221f44c18dfbb7c0b0140202bf488d2fcf88 Mon Sep 17 00:00:00 2001 From: Anton Nikolaev Date: Tue, 21 Jan 2020 08:03:16 -0800 Subject: [PATCH] Default path to Android SDK is wrong on Windows Summary: Default path for Android SDK was set to "/opt/android_sdk" disregard the current OS. On Windows it should be set to "%localappdata%\android\sdk" instead. Reviewed By: passy Differential Revision: D19496646 fbshipit-source-id: 86ce7df74b98eef5b7b0a556a5359bec8cb0dbc4 --- src/reducers/settings.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/reducers/settings.tsx b/src/reducers/settings.tsx index 9f9833d21..5dc9cba27 100644 --- a/src/reducers/settings.tsx +++ b/src/reducers/settings.tsx @@ -8,6 +8,8 @@ */ import {Actions} from './index'; +import os from 'os'; +import electron from 'electron'; export enum Tristate { True, @@ -40,8 +42,14 @@ export type Action = payload: Settings; }; +function getWindowsSdkPath() { + const app = electron.app || electron.remote.app; + return `${app.getPath('userData')}\\android\\sdk`; +} + const initialState: Settings = { - androidHome: '/opt/android_sdk', + androidHome: + os.platform() == 'win32' ? getWindowsSdkPath() : '/opt/android_sdk', enableAndroid: true, enablePrefetching: Tristate.Unset, jsApps: {