Files
bs-manager/src/main/util.ts
T
MathieuG-P 81c5a7928a Merge pull request #645 from Zagrios/bugfix/fix-oneclick-download-playlist-broken
[bugfix] Fix broken oneclick playlist download + issue with specials chars in playlists filenames

(cherry picked from commit d5f2ba3b21)
2024-11-05 20:53:12 +01:00

17 lines
554 B
TypeScript

/* eslint import/prefer-default-export: off, import/no-mutable-exports: off */
import { pathToFileURL, URL } from "url";
import path from "path";
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();
}
const filePath = path.resolve(__dirname, "..", "renderer");
return pathToFileURL(filePath).toString().concat("/", htmlFileName);
};