scholtzm / punk

⚡ Alternative cross-platform Steam client for desktop
MIT License
100 stars 29 forks source link

Asar packaging #22

Closed scholtzm closed 7 years ago

scholtzm commented 8 years ago

Packaging to asar archive right now seems to be causing trouble with node-steam-resources calling chdir.

Perhaps something can be done about this in the future.

scholtzm commented 7 years ago

I'll just copy this here from https://github.com/electron/asar/issues/55#issuecomment-266725820:

In my case, the dependency calls .chdir(__dirname) so I decided to use --unpack-dir flag to unpack this specific dependency. The result was:

  • app.asar.unpacked folder - this folder contains that one dependency I unpacked
  • app.asar file - according to asar list command, this file still contains the dependency as well 🤔

When the code is executing, __dirname points to folder inside app.asar (no idea why, it should be app.asar.unpacked ❓) and so it fails once again. If I place a breakpoint and modify __dirname to contain app.asar.unpacked, it works.

So far I have tried:

No matter what, the __dirname here always points to app.asar. According to asar list, the folder was also always contained inside app.asar.

scholtzm commented 7 years ago

Tested on both Windows and OSX, results are same.

Here's a small repro case I created: https://github.com/scholtzm/electron-asar-dirname-issue

Reported here: https://github.com/electron/electron/issues/8206

scholtzm commented 7 years ago

https://github.com/scholtzm/punk/commit/146349436006a8ac19ffa97df120bd08b663a7d5