Skip to content

Commit e4054d7

Browse files
authored
Fix the compilation window opening in the production (#555)
1 parent 6651bce commit e4054d7

File tree

4 files changed

+12
-11
lines changed

4 files changed

+12
-11
lines changed

package-lock.json

Lines changed: 6 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "pokemon-studio",
33
"productName": "Pokémon Studio",
44
"description": "Pokémon Studio is a monster taming game editor which helps you to bring your ideas to life, in just a few clicks.",
5-
"version": "2.6.0",
5+
"version": "2.6.1",
66
"main": "./.vite/build/index.js",
77
"license": "SEE LICENSE IN LICENSE.md",
88
"author": {

src/backendTasks/openCompilationWindow.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import log from 'electron-log';
22
import { defineBackendServiceFunction } from './defineBackendServiceFunction';
33
import { compilationConfig } from './getCompilationConfig';
4-
import WindowManager, { mainWindowViteDevServerUrl, mainWindowViteName } from './windowManager';
4+
import WindowManager, { mainWindowFilePath, mainWindowViteDevServerUrl } from './windowManager';
55
import { StudioCompilation } from '@components/compilation/CompilationDialogSchema';
6-
import path from 'path';
76

87
export type OpenCompilationWindowInput = {
98
configuration: StudioCompilation;
@@ -19,11 +18,10 @@ const openCompilationWindow = async (payload: OpenCompilationWindowInput) => {
1918
if (mainWindowViteDevServerUrl) {
2019
await compilationWindow.loadURL(mainWindowViteDevServerUrl);
2120
} else {
22-
compilationWindow.loadFile(path.join(__dirname, `../../renderer/${mainWindowViteName}/index.html`));
21+
await compilationWindow.loadFile(mainWindowFilePath);
2322
}
2423

2524
compilationConfig.push(payload.configuration);
26-
2725
compilationWindow.show();
2826

2927
return {};

src/backendTasks/windowManager.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ const mainWindowViteName = MAIN_WINDOW_VITE_NAME;
1414
const RESOURCES_PATH = app.isPackaged ? join(process.resourcesPath, 'assets') : join(__dirname, '../../assets');
1515
const getAssetPath = (...paths: string[]): string => join(RESOURCES_PATH, ...paths);
1616

17+
export const mainWindowFilePath = join(__dirname, `../renderer/${mainWindowViteName}/index.html`);
18+
1719
/**
1820
* TypeScript union type to allow both number and string
1921
*/
@@ -245,7 +247,7 @@ class WindowManager {
245247
if (mainWindowViteDevServerUrl) {
246248
newWindow.loadURL(mainWindowViteDevServerUrl);
247249
} else {
248-
newWindow.loadFile(join(__dirname, `../renderer/${mainWindowViteName}/index.html`));
250+
newWindow.loadFile(mainWindowFilePath);
249251
}
250252
}
251253

0 commit comments

Comments
 (0)