Merge pull request #1667 from xodio/fix-include-bundled-libs

Fix including of bundled Arduino libraries in dev mode
This commit is contained in:
Kirill Shumilov
2019-02-07 19:54:06 +03:00
committed by GitHub
2 changed files with 25 additions and 3 deletions

View File

@@ -54,10 +54,28 @@ export const getFilePathToOpen = app => {
return () => pathToOpen;
};
/**
* Returns Path to the resources directory root.
*
* When IDE runs in development mode it resolves to directory
* with transpiled code, and it handles call either from Main Process
* and Renderer Process. They're have a different `__dirname` values:
* - Main Process: /some/path/to/src-babel/app
* - Renderer Process: /some/path/to/src-babel
*
* When IDE runs in production mode it resolves to resources path.
*/
export const getResourcesRoot = () => {
if (IS_DEV) {
return process.type === 'renderer'
? __dirname
: path.resolve(__dirname, '..');
}
return process.resourcesPath;
};
/**
* Returns Path to the bundled workspace
*/
export const getPathToBundledWorkspace = () =>
IS_DEV
? path.resolve(__dirname, '../workspace')
: path.resolve(process.resourcesPath, './workspace');
path.join(getResourcesRoot(), 'workspace');

View File

@@ -9,6 +9,10 @@ const pkgpath = subpath => path.resolve(__dirname, subpath);
module.exports = merge.smart(getBaseConfig(__dirname), {
target: 'electron-renderer',
node: {
__dirname: false,
__filename: false,
},
entry: [
pkgpath('src/view/styles/main.scss'),
],