Fix static path calculation

Summary: Fixed a booboo where static path was calculated incorrectly

Reviewed By: rzlee

Differential Revision: D20447208

fbshipit-source-id: 80996fbaca77ccb7a95bfad47ce8297e14994a17
This commit is contained in:
Michel Weststrate
2020-03-14 03:58:30 -07:00
committed by Facebook GitHub Bot
parent 4ee6368cde
commit a60e6fee87

View File

@@ -17,10 +17,12 @@ export function getStaticPath() {
if (_staticPath) {
return _staticPath;
}
_staticPath = path.resolve(__dirname, '..', '..', 'static');
if (fs.existsSync(_staticPath)) {
return _staticPath;
}
if (remote && fs.existsSync(remote.app.getAppPath())) {
_staticPath = path.join(remote.app.getAppPath(), 'static');
} else {
_staticPath = path.resolve(__dirname, '..', '..', 'static');
_staticPath = path.join(remote.app.getAppPath());
}
if (!fs.existsSync(_staticPath)) {
throw new Error('Static path does not exist: ' + _staticPath);