Skip to content
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

asarUnpack unpacks parent directory when file is specified #1071

Closed
aouerf opened this issue Jan 1, 2017 · 11 comments · May be fixed by qcif/data-curator#563
Closed

asarUnpack unpacks parent directory when file is specified #1071

aouerf opened this issue Jan 1, 2017 · 11 comments · May be fixed by qcif/data-curator#563
Labels

Comments

@aouerf
Copy link

aouerf commented Jan 1, 2017

  • node v6.9.1:
  • npm v4.0.5:
  • electron-builder v10.15.1:
  • Target Build: win (ia32, x64):
  • Building On: win x64:

When a relative path from the app directory is passed into the build.asarUnpack option, the parent directory is copied instead of the file itself.

Example:

In package.json:

"build": {
    "asarUnpack": [
      "res/file.json"
    ]
}

In the shell:

npm run dist -- --win --ia32
Output Directory:

dist\win-ia32-unpacked\resources\app.asar.unpacked\res\<all files and sub-directories in original app/res, including file.json>

Other Notes:

I'm using the two package.json method (even without any external dependencies) if that matters.
I will try building this on macOS shortly and reporting back with my results.

@aouerf
Copy link
Author

aouerf commented Jan 1, 2017

Just tried it on macOS (building for darwin x64), same result.

@develar
Copy link
Member

develar commented Jan 2, 2017

Cannot reproduce (see my commit to test it). Please set env DEBUG=electron-builder and attach log of the terminal output.

@aouerf
Copy link
Author

aouerf commented Jan 2, 2017

The logs look fine to me:

> @ dist C:\Users\Ahmad Ouerfelli\Documents\Personal\station-timer
> build "--win" "--ia32"

No native production dependencies
Packaging for win32 ia32 using electron 1.4.13 to dist\win-ia32-unpacked
  electron-builder Spawning C:\Users\Ahmad Ouerfelli\Documents\Personal\station-timer\node_modules\7zip-bin-win\x64\7za.exe x -bd C:\Users\Ahmad Ouerfelli\.electron\electron-v1.4.13-w
in32-ia32.zip -oC:\Users\Ahmad Ouerfelli\Documents\Personal\station-timer\dist\win-ia32-unpacked +0ms

7-Zip (a) [64] 16.04 : Copyright (c) 1999-2016 Igor Pavlov : 2016-10-04

Scanning the drive for archives:
1 file, 44030471 bytes (42 MiB)

Extracting archive: C:\Users\Ahmad Ouerfelli\.electron\electron-v1.4.13-win32-ia32.zip
--
Path = C:\Users\Ahmad Ouerfelli\.electron\electron-v1.4.13-win32-ia32.zip
Type = zip
Physical Size = 44030471

Everything is Ok

Files: 74
Size:       108417432
Compressed: 44030471
  electron-builder C:\Users\Ahmad Ouerfelli\Documents\Personal\station-timer\node_modules\7zip-bin-win\x64\7za.exe (10572) exited with code 0 +3s
  electron-builder Dev or extraneous dependencies:  +0ms
  electron-builder Found existing winCodeSign C:\Users\Ahmad Ouerfelli\AppData\Local\electron-builder\cache\winCodeSign\winCodeSign-1.5.0 +788ms
  electron-builder Executing C:\Users\Ahmad Ouerfelli\AppData\Local\electron-builder\cache\winCodeSign\winCodeSign-1.5.0\rcedit.exe C:\Users\Ahmad Ouerfelli\Documents\Personal\station
-timer\dist\win-ia32-unpacked\Station Timer.exe --set-version-string CompanyName Ahmad Ouerfelli --set-version-string FileDescription Station Timer --set-version-string ProductName St
ation Timer --set-version-string InternalName Station Timer --set-version-string LegalCopyright Copyright © 2017 Ahmad Ouerfelli --set-version-string OriginalFilename  --set-file-vers
ion 1.0.0 --set-product-version 1.0.0 --set-icon C:\Users\Ahmad Ouerfelli\Documents\Personal\station-timer\build\icon.ico +0ms
Building zip
  electron-builder Spawning C:\Users\Ahmad Ouerfelli\Documents\Personal\station-timer\node_modules\7zip-bin-win\x64\7za.exe a -bd -mm=Deflate C:\Users\Ahmad Ouerfelli\Documents\Person
al\station-timer\dist\Station Timer-1.0.0-ia32-win.zip win-ia32-unpacked +763ms

7-Zip (a) [64] 16.04 : Copyright (c) 1999-2016 Igor Pavlov : 2016-10-04

Scanning the drive:
7 folders, 77 files, 108369660 bytes (104 MiB)

Creating archive: C:\Users\Ahmad Ouerfelli\Documents\Personal\station-timer\dist\Station Timer-1.0.0-ia32-win.zip

Items to compress: 84


Files read from disk: 77
Archive size: 42774627 bytes (41 MiB)
Everything is Ok
  electron-builder C:\Users\Ahmad Ouerfelli\Documents\Personal\station-timer\node_modules\7zip-bin-win\x64\7za.exe (9032) exited with code 0 +8s

Here is my development package.json:

{
  "scripts": {
    "start": "electron ./app",
    "dev": "nodemon --exec \"npm start\" -e \"js css html\"",
    "pack": "build --dir",
    "dist": "build",
    "postinstall": "install-app-deps"
  },
  "directories": {
    "app": "./app"
  },
  "build": {
    "appId": "com.aouerfelli.station-timer",
    "asarUnpack": [
      "res/strings.json"
    ],
    "win": {
      "target": [
        "zip"
      ]
    },
    "mac": {
      "category": "public.app-category.utilities",
      "target": [
        "dmg"
      ]
    },
    "linux": {
      "category": "Utility"
    }
  },
  "devDependencies": {
    "electron": "^1.4.13",
    "electron-builder": "^10.15.1",
    "nodemon": "^1.11.0"
  }
}

@develar
Copy link
Member

develar commented Jan 2, 2017

Is it possible to provide your project? (or I will try to investigate using some real my project).

@aouerf
Copy link
Author

aouerf commented Jan 2, 2017

Just pushed the initial code drop, you can view the project in this repo.

@andrewjaykeller
Copy link

andrewjaykeller commented Jan 2, 2017

I am seeing this error as well! Since the file is in the root dir of app, it's unpacking everything for me.

In @aouerfelli 's example, I am trying to unpack the foo.json in app dir

@develar
Copy link
Member

develar commented Jan 3, 2017

Bug identified. @aouerfelli But in your case it seems that *.wav and *.woff2 should be unpacked in any case?

develar added a commit to develar/electron-builder that referenced this issue Jan 3, 2017
@develar develar closed this as completed in 82f16d1 Jan 3, 2017
@develar develar added bug and removed reply-needed labels Jan 3, 2017
@aouerf
Copy link
Author

aouerf commented Jan 3, 2017

I thought about that too, but I'd rather not have those be replaceable and only allow the strings to be modified. If someone really wants to change the font or sound, they can clone the repo, edit it, the build it for themselves.
In any case, thanks for fixing it.

@develar
Copy link
Member

develar commented Jan 3, 2017

@aouerfelli So, you can use fonts inside asar archive and it works?

@aouerf
Copy link
Author

aouerf commented Jan 3, 2017

@develar Seems like it. I'll test it again just in case (because I already have that font installed on my local machine), but if the audio works, then I don't see why the font wouldn't work as well.
Update: Works fine in asar, tested with Windows and macOS.

@andrewjaykeller
Copy link

@develar thanks so much! this fixed my problem!! woo!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants