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,
|
androidHome,
|
||||||
enableIOS,
|
enableIOS,
|
||||||
enablePrefetching,
|
enablePrefetching,
|
||||||
|
idbPath,
|
||||||
reactNative,
|
reactNative,
|
||||||
} = this.state.updatedSettings;
|
} = this.state.updatedSettings;
|
||||||
|
|
||||||
@@ -104,7 +105,7 @@ class SettingsSheet extends Component<Props, State> {
|
|||||||
});
|
});
|
||||||
}}>
|
}}>
|
||||||
<FilePathConfigField
|
<FilePathConfigField
|
||||||
label="Android SDK Location"
|
label="Android SDK location"
|
||||||
resetValue={DEFAULT_ANDROID_SDK_PATH}
|
resetValue={DEFAULT_ANDROID_SDK_PATH}
|
||||||
defaultValue={androidHome}
|
defaultValue={androidHome}
|
||||||
onChange={(v) => {
|
onChange={(v) => {
|
||||||
@@ -137,6 +138,16 @@ class SettingsSheet extends Component<Props, State> {
|
|||||||
content={'iOS development is only supported on MacOS'}
|
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>
|
</ToggledSection>
|
||||||
<LauncherSettingsPanel
|
<LauncherSettingsPanel
|
||||||
isPrefetchingEnabled={enablePrefetching}
|
isPrefetchingEnabled={enablePrefetching}
|
||||||
|
|||||||
@@ -55,11 +55,13 @@ export function FilePathConfigField(props: {
|
|||||||
defaultValue: string;
|
defaultValue: string;
|
||||||
onChange: (path: string) => void;
|
onChange: (path: string) => void;
|
||||||
frozen?: boolean;
|
frozen?: boolean;
|
||||||
|
// Defaults to allowing directories only, this changes to expect regular files.
|
||||||
|
isRegularFile?: boolean;
|
||||||
}) {
|
}) {
|
||||||
const [value, setValue] = useState(props.defaultValue);
|
const [value, setValue] = useState(props.defaultValue);
|
||||||
const [isValid, setIsValid] = useState(true);
|
const [isValid, setIsValid] = useState(true);
|
||||||
fs.stat(value)
|
fs.stat(value)
|
||||||
.then((stat) => stat.isDirectory())
|
.then((stat) => props.isRegularFile !== stat.isDirectory())
|
||||||
.then((valid) => {
|
.then((valid) => {
|
||||||
if (valid !== isValid) {
|
if (valid !== isValid) {
|
||||||
setIsValid(valid);
|
setIsValid(valid);
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ export type Settings = {
|
|||||||
* of Flipper.
|
* of Flipper.
|
||||||
*/
|
*/
|
||||||
enablePrefetching: Tristate;
|
enablePrefetching: Tristate;
|
||||||
|
idbPath: string;
|
||||||
jsApps: {
|
jsApps: {
|
||||||
webAppLauncher: {
|
webAppLauncher: {
|
||||||
url: string;
|
url: string;
|
||||||
@@ -57,6 +58,7 @@ const initialState: Settings = {
|
|||||||
enableAndroid: true,
|
enableAndroid: true,
|
||||||
enableIOS: os.platform() === 'darwin',
|
enableIOS: os.platform() === 'darwin',
|
||||||
enablePrefetching: Tristate.Unset,
|
enablePrefetching: Tristate.Unset,
|
||||||
|
idbPath: '/usr/local/bin/idb',
|
||||||
jsApps: {
|
jsApps: {
|
||||||
webAppLauncher: {
|
webAppLauncher: {
|
||||||
url: 'http://localhost:8888',
|
url: 'http://localhost:8888',
|
||||||
|
|||||||
Reference in New Issue
Block a user