go-astilectron icon indicating copy to clipboard operation
go-astilectron copied to clipboard

it don't need to unzip electron again and again

Open welldonexing opened this issue 5 years ago • 9 comments

func (p *defaultProvisioner) Provision(ctx context.Context, appName, os, arch, versionAstilectron, versionElectron string, paths Paths) (err error) { // Retrieve provision status var s ProvisionStatus if s, err = p.ProvisionStatus(paths); err != nil { err = fmt.Errorf("retrieving provisioning status failed: %w", err) return } defer p.updateProvisionStatus(paths, &s)

// Provision astilectron
if err = p.provisionAstilectron(ctx, paths, s, versionAstilectron); err != nil {
	err = fmt.Errorf("provisioning astilectron failed: %w", err)
	return
}
s.Astilectron = &ProvisionStatusPackage{Version: versionAstilectron}

if (!FileExist(paths.appExecutable)){//not to unzip again electron
       //not to unzip again electron

// Provision electron
if err = p.provisionElectron(ctx, paths, s, appName, os, arch, versionElectron); err != nil {
	err = fmt.Errorf("provisioning electron failed: %w", err)
	return
}
}
s.Electron[provisionStatusElectronKey(os, arch)] = &ProvisionStatusPackage{Version: versionElectron}
return

}

after i change like this, , init faster , unzip electron takes a lot of time ,we don t need to do it everytime .very dont check it?

welldonexing avatar Jul 23 '20 23:07 welldonexing

What command do you run to execute your go code ? go run *.go ?

asticode avatar Jul 24 '20 13:07 asticode

What command do you run to execute your go code ? go run *.go ?

after i use astilectron-bundler to build the Astilectron demo.exe ,and use double click to run it .

welldonexing avatar Jul 24 '20 13:07 welldonexing

how i found it because my antivirus show that it access d3dcompiler_47.dll everytime,that is system dll ,so it warn. QQ截图20200724212525

welldonexing avatar Jul 24 '20 13:07 welldonexing

and after i check it and dont Provision electron secondtime ,the problem solve . my antivirus dont show again. that means Provision electron maybe has son bug ,unzip everytime. i suggest that you can use a option arg to set the electron path.that we can use self electron path. don't unzip and write it. .

welldonexing avatar Jul 24 '20 13:07 welldonexing

It downloads Electron every time I go run main.go.

go.mod:

go 1.13

require (
	github.com/asticode/go-astikit v0.6.0
	github.com/asticode/go-astilectron v0.16.0
	github.com/asticode/go-astilectron-bootstrap v0.4.1
)

go1.13.4 darwin/amd64.

Is that expected?

alltom avatar Aug 28 '20 06:08 alltom

It downloads Electron every time I go run main.go.

go.mod:

go 1.13

require (
	github.com/asticode/go-astikit v0.6.0
	github.com/asticode/go-astilectron v0.16.0
	github.com/asticode/go-astilectron-bootstrap v0.4.1
)

go1.13.4 darwin/amd64.

Is that expected?

i haven t found it ,just download once in the temp dir .but unzip every time when release

welldonexing avatar Aug 28 '20 07:08 welldonexing

@alltom if you don't specify a BaseDirectoryPath, astilectron will default to the current directory. When you run go run, it generates a different temp dir everytime.

astilectron checks whether Electron is already set up in the BaseDirectoryPath before downloading it, but as your dir path changes everytime, it downloads Electron everytime.

The best solution for this is replacing go run main.go by something like go build -o binary main.go && ./binary.

asticode avatar Aug 28 '20 10:08 asticode

@asticode Makes sense. Thank you very much!

alltom avatar Aug 28 '20 22:08 alltom

Please, make optional dialog with message "need internet connection for downloading some data. Continue? yes.no" ps Cool project! Best golang gui!

SilentGopherLnx avatar Oct 23 '21 10:10 SilentGopherLnx