mirror of
https://github.com/Zagrios/bs-manager.git
synced 2026-07-03 14:08:25 +02:00
Merge pull request #636 from Zagrios/bugfix/unable-to-load-bsm-files-if-path-to-bsm-contains-url-special-chars
[bugfix] Unable to load bsm's files if path to bsm contain url special chars
(cherry picked from commit 6666685c43)
This commit is contained in:
+10
-12
@@ -1,17 +1,15 @@
|
||||
/* eslint import/prefer-default-export: off, import/no-mutable-exports: off */
|
||||
import { URL } from "url";
|
||||
import { pathToFileURL, URL } from "url";
|
||||
import path from "path";
|
||||
|
||||
export let resolveHtmlPath: (htmlFileName: string) => string;
|
||||
|
||||
if (process.env.NODE_ENV === "development") {
|
||||
const port = process.env.PORT || 1212;
|
||||
resolveHtmlPath = (htmlFileName: string) => {
|
||||
export function resolveHtmlPath (htmlFileName: string) {
|
||||
if (process.env.NODE_ENV === "development") {
|
||||
const port = process.env.PORT || 1212;
|
||||
const url = new URL(`http://localhost:${port}/${htmlFileName}`);
|
||||
return url.toString();
|
||||
};
|
||||
} else {
|
||||
resolveHtmlPath = (htmlFileName: string) => {
|
||||
return `file://${path.resolve(__dirname, "../renderer/", htmlFileName)}`;
|
||||
};
|
||||
}
|
||||
}
|
||||
const filePath = path.resolve(__dirname, "..", "renderer", htmlFileName);
|
||||
return pathToFileURL(filePath).toString();
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user