asticode / go-astilectron-bootstrap

Create a one-window application using Astilectron

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unzip astilectron issue

MiyamuraMiyako opened this issue · comments

I think, p.astilectronUnzipSrc should equal p.astilectronDownloadDst.

image

Otherwise there will be a decompression error

{"level":"fatal","msg":"running bootstrap failed: starting astilectron failed: provisioning failed: provisioning astilectron failed: unzipping d:\\go\\src\\hlst\\kiosk\\hospital\\vendor\\astilectron-v0.27.0.zip\\astilectron-0.27.0 into d:\\go\\src\\hlst\\kiosk\\hospital\\vendor\\astilectron failed: unzipping d:\\go\\src\\hlst\\kiosk\\hospital\\vendor\\astilectron-v0.27.0.zip\\astilectron-0.27.0 into d:\\go\\src\\hlst\\kiosk\\hospital\\vendor\\astilectron failed: astiarchive: opening overall zip reader on d:\\go\\src\\hlst\\kiosk\\hospital\\vendor\\astilectron-v0.27.0.zip failed: zip: not a valid zip file","time":"2018-09-10T22:58:01+08:00"}

@MiyamuraMiyako no this is done on purpose. Adding fmt.Sprintf("astilectron-%s, VersionAstilectron) allow targeting the folder astilectron-v0.27.0 in your zip file since the structure of the zip file is:

+-- astilectron-v0.27.0
+-- the files and folders

Does this make sense?

p.astilectronDownloadDst is local astilectron archive fullpath.

p.astilectronUnzipSrc = filepath.Join(p.astilectronDownloadDst, fmt.Sprintf("astilectron-%s", VersionAstilectron)) will /path/to/astilectron-astilectron-v0.27.0.zip/astilectron-astilectron-v0.27.0
I can't understand how to decompress this file.

Interesting is p.electronUnzipSrc = p.electronDownloadDst, why astilectron not?

image

@MiyamuraMiyako the bootstrap is using this method to decompress the zip files.

When you open electron's zip, the content is at the root. When you open astilectron's zip, the content is in a directory called astilectron-v0.27.0.

If we use p.astilectronDownloadDst only, here's what you'll have on disk:

+ astilectronv0.27.0
|-- file 1
|-- file 2

Which is not what we want. We want that:

+ file 1
+ file 2

To do so, we use <path to the zip file>/<path inside the zip file> therefore filepath.Join(p.astilectronDownloadDst, fmt.Sprintf("astilectron-%s", VersionAstilectron)).

Does that make sense?

@asticode Thank you. I understand.