Skip to content

Commit

Permalink
Fix macos loading issue
Browse files Browse the repository at this point in the history
  • Loading branch information
spaaaacccee committed May 26, 2024
1 parent 08e48a9 commit 50707bc
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions client/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,28 @@ const map = {

const server = http.createServer((req, res) => {
// extract URL path

let pathname1 = `./${
url.parse(
path.join(
electron.app.isPackaged ? "resources/app/dist" : "dist",
electron.app.isPackaged
? path.join(electron.app.getAppPath(), "dist")
: "dist",
req.url
)
).pathname
}`;
// Try again for macos
pathname1 = fs.existsSync(pathname1)
? pathname1
: fs.existsSync(path.resolve(__dirname, pathname1))
? path.resolve(__dirname, pathname1)
: `./${
url.parse(
path.join(
electron.app.isPackaged ? "resource/app/dist" : "dist",
req.url
)
).pathname
}`;
let pathname = fs.existsSync(pathname1)
? pathname1
: path.resolve(__dirname, pathname1);
Expand Down

0 comments on commit 50707bc

Please sign in to comment.