Skip to content

Commit b7b06f0

Browse files
authored
Support fix-path in non-bundled environments (#14819)
1 parent 71e4f15 commit b7b06f0

File tree

5 files changed

+19
-22
lines changed

5 files changed

+19
-22
lines changed

dev-packages/application-manager/src/generator/backend-generator.ts

+17-17
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,6 @@ export class BackendGenerator extends AbstractGenerator {
3737
3838
require('@theia/core/shared/reflect-metadata');
3939
40-
// Useful for Electron/NW.js apps as GUI apps on macOS doesn't inherit the \`$PATH\` define
41-
// in your dotfiles (.bashrc/.bash_profile/.zshrc/etc).
42-
// https://github.com/electron/electron/issues/550#issuecomment-162037357
43-
// https://github.com/eclipse-theia/theia/pull/3534#issuecomment-439689082
44-
require('@theia/core/electron-shared/fix-path').default();
45-
4640
// Workaround for https://github.com/electron/electron/issues/9225. Chrome has an issue where
4741
// in certain locales (e.g. PL), image metrics are wrongly computed. We explicitly set the
4842
// LC_NUMERIC to prevent this from happening (selects the numeric formatting category of the
@@ -52,18 +46,24 @@ if (process.env.LC_ALL) {
5246
}
5347
process.env.LC_NUMERIC = 'C';
5448
55-
const { resolve } = require('path');
56-
const theiaAppProjectPath = resolve(__dirname, '..', '..');
57-
process.env.THEIA_APP_PROJECT_PATH = theiaAppProjectPath;
58-
const { default: electronMainApplicationModule } = require('@theia/core/lib/electron-main/electron-main-application-module');
59-
const { ElectronMainApplication, ElectronMainApplicationGlobals } = require('@theia/core/lib/electron-main/electron-main-application');
60-
const { Container } = require('@theia/core/shared/inversify');
61-
const { app } = require('electron');
62-
63-
const config = ${this.prettyStringify(this.pck.props.frontend.config)};
64-
const isSingleInstance = ${this.pck.props.backend.config.singleInstance === true ? 'true' : 'false'};
65-
6649
(async () => {
50+
// Useful for Electron/NW.js apps as GUI apps on macOS doesn't inherit the \`$PATH\` define
51+
// in your dotfiles (.bashrc/.bash_profile/.zshrc/etc).
52+
// https://github.com/electron/electron/issues/550#issuecomment-162037357
53+
// https://github.com/eclipse-theia/theia/pull/3534#issuecomment-439689082
54+
(await require('@theia/core/electron-shared/fix-path')).default();
55+
56+
const { resolve } = require('path');
57+
const theiaAppProjectPath = resolve(__dirname, '..', '..');
58+
process.env.THEIA_APP_PROJECT_PATH = theiaAppProjectPath;
59+
const { default: electronMainApplicationModule } = require('@theia/core/lib/electron-main/electron-main-application-module');
60+
const { ElectronMainApplication, ElectronMainApplicationGlobals } = require('@theia/core/lib/electron-main/electron-main-application');
61+
const { Container } = require('@theia/core/shared/inversify');
62+
const { app } = require('electron');
63+
64+
const config = ${this.prettyStringify(this.pck.props.frontend.config)};
65+
const isSingleInstance = ${this.pck.props.backend.config.singleInstance === true ? 'true' : 'false'};
66+
6767
if (isSingleInstance && !app.requestSingleInstanceLock()) {
6868
// There is another instance running, exit now. The other instance will request focus.
6969
app.quit();

packages/core/README.md

-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ export class SomeClass {
7474
- `native-keymap` (from [`native-keymap@^2.2.1`](https://www.npmjs.com/package/native-keymap))
7575
- `electron` (from [`[email protected]`](https://www.npmjs.com/package/electron/v/30.1.2))
7676
- `electron-store` (from [`electron-store@^8.0.0`](https://www.npmjs.com/package/electron-store))
77-
- `fix-path` (from [`fix-path@^4.0.0`](https://www.npmjs.com/package/fix-path))
7877
- `@theia/core/shared/...`
7978
- `@lumino/algorithm` (from [`@lumino/algorithm@^2.0.2`](https://www.npmjs.com/package/@lumino/algorithm))
8079
- `@lumino/commands` (from [`@lumino/commands@^2.3.1`](https://www.npmjs.com/package/@lumino/commands))

packages/electron/README.md

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ The `@theia/electron` extension bundles all Electron-specific dependencies and c
2020
- `native-keymap` (from [`native-keymap@^2.2.1`](https://www.npmjs.com/package/native-keymap))
2121
- `electron` (from [`[email protected]`](https://www.npmjs.com/package/electron/v/30.1.2))
2222
- `electron-store` (from [`electron-store@^8.0.0`](https://www.npmjs.com/package/electron-store))
23-
- `fix-path` (from [`fix-path@^4.0.0`](https://www.npmjs.com/package/fix-path))
2423

2524
## Additional Information
2625

packages/electron/package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@
2121
],
2222
"export =": [
2323
"electron as Electron",
24-
"electron-store as ElectronStore",
25-
"fix-path as fixPath"
24+
"electron-store as ElectronStore"
2625
]
2726
}
2827
},
+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
module.exports = require('fix-path');
1+
module.exports = import('fix-path');

0 commit comments

Comments
 (0)