Pass URL and file arguments to launcher
Summary: Changes where we delegate to the launcher to a later point so we can successfully intercept file open events and custom URI events. There's more information in Phase 1 in this paragraph of the doc: https://fb.quip.com/tpqnAbxnJw1w#UNZACAnVVGs Reviewed By: danielbuechele Differential Revision: D14563585 fbshipit-source-id: a8757a6072386e56102f15b0668456369a44aad7
This commit is contained in:
committed by
Facebook Github Bot
parent
939cc531e2
commit
759329bbc3
@@ -10,38 +10,7 @@ const os = require('os');
|
||||
const fs = require('fs');
|
||||
const {spawn} = require('child_process');
|
||||
|
||||
const isProduction = () =>
|
||||
!/node_modules[\\/]electron[\\/]/.test(process.execPath);
|
||||
|
||||
const isLauncherInstalled = () => {
|
||||
if (os.type() == 'Darwin') {
|
||||
const receipt = 'com.facebook.flipper.launcher';
|
||||
const plistLocation = '/Applications/Flipper.app/Contents/Info.plist';
|
||||
return (
|
||||
fs.existsSync(plistLocation) &&
|
||||
fs.readFileSync(plistLocation).indexOf(receipt) > 0
|
||||
);
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
const startLauncher = () => {
|
||||
if (os.type() == 'Darwin') {
|
||||
spawn('open', ['/Applications/Flipper.app']);
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = function(argv) {
|
||||
if (argv.launcher && isProduction() && isLauncherInstalled()) {
|
||||
console.warn('Delegating to Flipper Launcher ...');
|
||||
console.warn(
|
||||
`You can disable this behavior by passing '--no-launcher' at startup.`,
|
||||
);
|
||||
startLauncher();
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
if (!process.env.ANDROID_HOME) {
|
||||
process.env.ANDROID_HOME = '/opt/android_sdk';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user