Properly resolve path to icons.json in release build
Summary: Currently release build fails to launch, because path to icons.json is resolved incorrectly. This change should fix resolving so it will work for both dev and release build. Reviewed By: jknoxville, mweststrate Differential Revision: D19274410 fbshipit-source-id: 9c0a92e1f6808997d08366c8021cd57565c5ae2c
This commit is contained in:
committed by
Facebook Github Bot
parent
e7173e060c
commit
901817040c
@@ -16,9 +16,12 @@ const fs = require('fs');
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
const {remote} = require('electron');
|
const {remote} = require('electron');
|
||||||
|
|
||||||
const iconsPath = fs.existsSync(path.resolve(process.cwd(), 'icons.json'))
|
const staticPath = path.resolve(__dirname, '..', '..', 'static');
|
||||||
? path.resolve(process.cwd(), 'icons.json') // development
|
const appPath = remote ? remote.app.getAppPath() : staticPath;
|
||||||
: path.resolve(process.cwd(), 'static', 'icons.json'); // build
|
const iconsPath = fs.existsSync(path.resolve(appPath, 'icons.json'))
|
||||||
|
? path.resolve(appPath, 'icons.json')
|
||||||
|
: path.resolve(staticPath, 'icons.json');
|
||||||
|
|
||||||
const ICONS = JSON.parse(fs.readFileSync(iconsPath, {encoding: 'utf8'}));
|
const ICONS = JSON.parse(fs.readFileSync(iconsPath, {encoding: 'utf8'}));
|
||||||
|
|
||||||
// Takes a string like 'star', or 'star-outline', and converts it to
|
// Takes a string like 'star', or 'star-outline', and converts it to
|
||||||
|
|||||||
Reference in New Issue
Block a user