From 17763809dd4b6857b1e87ae8f0910fd242c4cd53 Mon Sep 17 00:00:00 2001 From: John Knox Date: Thu, 4 Jun 2020 03:01:18 -0700 Subject: [PATCH] Add a setting for location of idb binary Summary: Part of https://github.com/facebook/flipper/issues/262 The default is the location on facebook computers, to avoid breaking it for existing users. Reviewed By: passy Differential Revision: D21860237 fbshipit-source-id: f4adfba0c63f7bb10751effb012dda734c455bee --- desktop/app/src/chrome/SettingsSheet.tsx | 13 ++++++++++++- desktop/app/src/chrome/settings/configFields.tsx | 4 +++- desktop/app/src/reducers/settings.tsx | 2 ++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/desktop/app/src/chrome/SettingsSheet.tsx b/desktop/app/src/chrome/SettingsSheet.tsx index 514fa2b0e..e58471af7 100644 --- a/desktop/app/src/chrome/SettingsSheet.tsx +++ b/desktop/app/src/chrome/SettingsSheet.tsx @@ -86,6 +86,7 @@ class SettingsSheet extends Component { androidHome, enableIOS, enablePrefetching, + idbPath, reactNative, } = this.state.updatedSettings; @@ -104,7 +105,7 @@ class SettingsSheet extends Component { }); }}> { @@ -137,6 +138,16 @@ class SettingsSheet extends Component { content={'iOS development is only supported on MacOS'} /> )} + { + this.setState({ + updatedSettings: {...this.state.updatedSettings, idbPath: v}, + }); + }} + /> void; frozen?: boolean; + // Defaults to allowing directories only, this changes to expect regular files. + isRegularFile?: boolean; }) { const [value, setValue] = useState(props.defaultValue); const [isValid, setIsValid] = useState(true); fs.stat(value) - .then((stat) => stat.isDirectory()) + .then((stat) => props.isRegularFile !== stat.isDirectory()) .then((valid) => { if (valid !== isValid) { setIsValid(valid); diff --git a/desktop/app/src/reducers/settings.tsx b/desktop/app/src/reducers/settings.tsx index 88e4906b2..8966193ee 100644 --- a/desktop/app/src/reducers/settings.tsx +++ b/desktop/app/src/reducers/settings.tsx @@ -27,6 +27,7 @@ export type Settings = { * of Flipper. */ enablePrefetching: Tristate; + idbPath: string; jsApps: { webAppLauncher: { url: string; @@ -57,6 +58,7 @@ const initialState: Settings = { enableAndroid: true, enableIOS: os.platform() === 'darwin', enablePrefetching: Tristate.Unset, + idbPath: '/usr/local/bin/idb', jsApps: { webAppLauncher: { url: 'http://localhost:8888',