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
This commit is contained in:
committed by
Facebook GitHub Bot
parent
91d5c6c130
commit
17763809dd
@@ -86,6 +86,7 @@ class SettingsSheet extends Component<Props, State> {
|
||||
androidHome,
|
||||
enableIOS,
|
||||
enablePrefetching,
|
||||
idbPath,
|
||||
reactNative,
|
||||
} = this.state.updatedSettings;
|
||||
|
||||
@@ -104,7 +105,7 @@ class SettingsSheet extends Component<Props, State> {
|
||||
});
|
||||
}}>
|
||||
<FilePathConfigField
|
||||
label="Android SDK Location"
|
||||
label="Android SDK location"
|
||||
resetValue={DEFAULT_ANDROID_SDK_PATH}
|
||||
defaultValue={androidHome}
|
||||
onChange={(v) => {
|
||||
@@ -137,6 +138,16 @@ class SettingsSheet extends Component<Props, State> {
|
||||
content={'iOS development is only supported on MacOS'}
|
||||
/>
|
||||
)}
|
||||
<FilePathConfigField
|
||||
label="IDB binary location"
|
||||
defaultValue={idbPath}
|
||||
isRegularFile={true}
|
||||
onChange={(v) => {
|
||||
this.setState({
|
||||
updatedSettings: {...this.state.updatedSettings, idbPath: v},
|
||||
});
|
||||
}}
|
||||
/>
|
||||
</ToggledSection>
|
||||
<LauncherSettingsPanel
|
||||
isPrefetchingEnabled={enablePrefetching}
|
||||
|
||||
@@ -55,11 +55,13 @@ export function FilePathConfigField(props: {
|
||||
defaultValue: string;
|
||||
onChange: (path: string) => 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);
|
||||
|
||||
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user