New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extraResources get copied to the wrong folder on Linux/Windows #379

Closed
GabeIsman opened this Issue May 4, 2016 · 14 comments

Comments

Projects
None yet
3 participants
@GabeIsman
Copy link

GabeIsman commented May 4, 2016

I am trying to build a .deb, and the folder that I specify in extraResources ends up in the wrong place.

Config:

"build": {
    "app-bundle-id": "apple.app.id",
    "app-category-type": "public.app-category.utilities",
    "productName": "Product",
    "asar": false,
    "extraResources": ["dist/"],
    "osx": {
      "background": "app/assets/bg.jpg",
      "icon": "build/icons/app.icns"
    },
    "linux": {
    }
  },
  "directories": {
    "output": "release"
  },

The intermediate packager output looks like

release/
|-Product-linux-x64/
  |-...
  |-resources/
  |-dist/
  |-...

When I install and run the .deb I electron gives me file not found errors looking for resources/dist/bundle.js and resources/dist/bundle.css.

@develar

This comment has been minimized.

Copy link
Member

develar commented May 5, 2016

The problem is that you don't understand correctly for what this option is. I will fix docs.

We do not copy extra resources into your app, we copy extra resources into your "executable". Why?

"
Our library is dependant on qt libraries (must be located at the application root folder) and also some qt plugin dlls must be exactly at specific relative paths (for example ./platforms/qwindows.dll and ./printsupport/windowsprintersupport.dll) or app crashes with an error on node-ffi library load. It's Qt's requirement and we can't simply restructure it.
"

As far I see in your pull request (thanks that you decided to contribute), you want to copy files into your js app.

Please explain — why you cannot just use these files as part of your app? Please note – your app files should be packed into asar archive due to performance (especially on Windows). And we pack into asar by default. If you want to access some files directly (exec, spawn), you should use asar-unpack (https://github.com/electron-userland/electron-packager/blob/master/docs/api.md#asar-unpack).

@develar develar added the invalid label May 10, 2016

@develar

This comment has been minimized.

Copy link
Member

develar commented May 10, 2016

Feel free to reopen when you will have time to answer.

@develar develar closed this May 10, 2016

@GabeIsman

This comment has been minimized.

Copy link

GabeIsman commented May 11, 2016

Hey @develar, thanks for answering!

I'm building my app with webpack so the distinction between 'application source code' and 'built javascript app' is important, and I got confused about which corresponded to the electron-builder 'app' folder (it's the built javascript app). So basically I was packaging up my source code and then trying to copy in the actual app 😄.

My working setup now looks like this:

  • src/ folder for my source code (es6) that will be compiled through webpack
  • app/ folder for my static source (main.js, app.html, etc.), built assets (bundle.js, bundle.css, etc), and package.json describing any external app dependencies that can't be packaged with webpack (native dependencies mostly).
  • build/ folder for electron-builder related assets (icons, etc.)
  • asar turned off since it's irrelevant when your entire app is ~4 files, and also it breaks ffi.Library

This is a project using a similar setup: https://github.com/xwartz/douban.fm. Would be worth, I think, adding a sentence to the documentation for people with related setups.

@develar

This comment has been minimized.

Copy link
Member

develar commented May 12, 2016

Thank you for detailed answer.

So, now there are no issues and all is ok?

FYI: #326 (comment)

Reopened — must be documented.

@GabeIsman

This comment has been minimized.

Copy link

GabeIsman commented May 12, 2016

Yep, seems to be working well now! Tested on Mac and Debian so far.

On Thursday, May 12, 2016, Vladimir Krivosheev notifications@github.com
wrote:

Thank you for detailed answer.

So, now there are no issues and all is ok?

FYI: #326 (comment)
#326 (comment)

Reopened — must be documented.


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#379 (comment)

@jbleuzen

This comment has been minimized.

Copy link

jbleuzen commented May 27, 2016

Hi, I'm having the same issue with my app. I read the whole Issue and thought it was not useful to create a new one.

I'm building an app with the Widevine module and after building on Windows, the extraResources are not located in resources folder.

Here is my conf :

"osx": {
      ...
      "extraResources": [
        "WidevineCDM/darwin"
      ]
    },
    "win": {
      ...
      "extraResources": [
        "WidevineCDM/win32/${arch}"
      ]
}

The thing that I don't understand, is why on OSX the extraResources are located beside my generated app.asar file in "Resources" and not on Windows ?

I wanted to use extraResources and not put these files directly in my app folder because I don't want to include others OS libs in my app and I also want to be able to "asar" my app. I can't "asar" my app if I have to include lib in it.

@develar

This comment has been minimized.

Copy link
Member

develar commented May 27, 2016

@jbleuzen If I understand correctly — you get different result using the same configuration on OS X and Windows (you build app for windows on OS X and result is not equal to result if build for windows on Windows)?

@develar

This comment has been minimized.

Copy link
Member

develar commented May 27, 2016

@jbleuzen Ah, I see — your question is why we put extraResources for OS X app into Contents/Resources, but not into Contents?

@jbleuzen

This comment has been minimized.

Copy link

jbleuzen commented May 27, 2016

Answering the second question : Yes it doesn't look "homogeneous" (if I may use this word)....
On OSX I'm loading the widevine library using : ${__dirname}/../WidevineCDM/myfile and on Windows I would need to load the plugin with : ${__dirname}/../../WidevineCDM/myfile.

If the extraResources goes into resources, I don't have this problem... :/

@develar

This comment has been minimized.

Copy link
Member

develar commented May 27, 2016

Fix:

  • extraResources must copy files into the same dir where electron app located (app.asar).
  • In addition to extraResources, extraFiles must be added to copy files as extraResources does before with one exception – on OS X into the Contents.

Will be implemented in the next major release.

@jbleuzen

This comment has been minimized.

Copy link

jbleuzen commented May 27, 2016

Yes that will be a good implementation...
Thanks

@develar

This comment has been minimized.

Copy link
Member

develar commented May 30, 2016

@jbleuzen Please try 4.x

@jbleuzen

This comment has been minimized.

Copy link

jbleuzen commented May 30, 2016

Yes, it works with the 0.4.0 you can close in my opinion !

@develar develar added the backlog label Jun 2, 2016

@develar

This comment has been minimized.

Copy link
Member

develar commented Jun 2, 2016

Would be worth, I think, adding a sentence to the documentation for people with related setups.

Help wanted. https://github.com/electron-userland/electron-builder/blob/master/CONTRIBUTING.md#documentation

@develar develar closed this Jun 2, 2016

develar added a commit to develar/electron-builder that referenced this issue Jun 2, 2016

develar added a commit to develar/electron-builder that referenced this issue Jun 2, 2016

develar added a commit that referenced this issue Jun 2, 2016

develar added a commit to develar/electron-builder that referenced this issue Jun 2, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment