Caprine: The About dialog produces a JS error

Created on 19 Mar 2020  路  3Comments  路  Source: sindresorhus/caprine

Clicking Help -> About Caprine produces the following error message:

image

I'm using v2.44.0 on Ubuntu 18.04, installed from the DEB package.

bug help wanted

Most helpful comment

Base idea is to move the Icon.png out of app.asar.

Solutions:

  • asarUnpack - ~moves~ copies (the file will be in both .unpacked dir and app.asar) selected files into app.asar.unpacked, path module should resolve paths to the file in this directory, not in app.asar file - does not work.

    • Works only in conjuction with aditional module hazardous - 3 years old, but works everywhere.

    • Increases size (the file is in two locations).

  • extraResources - places selected file directly into resources/ folder, files there aren't getting packed into app.asar.

    • Breaks development, direct path.process.resourcesPath is then used as base path, instead of joining __dirname and relative path to that.

    • We can work even with the above with few ifs (!is.development mainly).

    • Does not add additional modules:)



First issue about using asar paths and the problems around them is from 11th May 2016.

https://github.com/electron-userland/electron-builder/issues/390
https://github.com/electron/electron/issues/6262
https://github.com/electron-userland/electron-builder/issues/1120

And one still needs an external module to solve it's discrepancies, someone in electron basically agreed that instead of fixing/making it usable they will let others make a module for it, and then why not just use the code in that module to fix the problems in a first place?

I really wonder how much lifeticks have problems with asar already eaten. (As, don't even expect official docs to specify anything like this.)

All 3 comments

Going thru Electron's code of that aboutPanel (for linux), it does not really seem there is any logic for reading the image from asar files, it goes straight to gdk_pixbuf_new_from_file_at_size (let's say, reading a image file:) ).

So the iconPath option in api.app.setAboutPanelOptions has to be a direct path to a file.

Edit: caprineIconPath points to the app.asar file (created after packaging, can be produced with electron-packager --dir)

Base idea is to move the Icon.png out of app.asar.

Solutions:

  • asarUnpack - ~moves~ copies (the file will be in both .unpacked dir and app.asar) selected files into app.asar.unpacked, path module should resolve paths to the file in this directory, not in app.asar file - does not work.

    • Works only in conjuction with aditional module hazardous - 3 years old, but works everywhere.

    • Increases size (the file is in two locations).

  • extraResources - places selected file directly into resources/ folder, files there aren't getting packed into app.asar.

    • Breaks development, direct path.process.resourcesPath is then used as base path, instead of joining __dirname and relative path to that.

    • We can work even with the above with few ifs (!is.development mainly).

    • Does not add additional modules:)



First issue about using asar paths and the problems around them is from 11th May 2016.

https://github.com/electron-userland/electron-builder/issues/390
https://github.com/electron/electron/issues/6262
https://github.com/electron-userland/electron-builder/issues/1120

And one still needs an external module to solve it's discrepancies, someone in electron basically agreed that instead of fixing/making it usable they will let others make a module for it, and then why not just use the code in that module to fix the problems in a first place?

I really wonder how much lifeticks have problems with asar already eaten. (As, don't even expect official docs to specify anything like this.)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Martina-Neumayer picture Martina-Neumayer  路  4Comments

sindresorhus picture sindresorhus  路  4Comments

dmythro picture dmythro  路  4Comments

ChristianKlee picture ChristianKlee  路  4Comments

charlwillia6 picture charlwillia6  路  4Comments