From c251fc8551649defb866593dab221b182850c999 Mon Sep 17 00:00:00 2001 From: equanox Date: Tue, 12 Feb 2019 17:45:50 +0100 Subject: [PATCH] fix permission bug with .gotron dir --- Makefile | 2 +- gotron_methods.go | 25 ++++++++++++++----------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 3716a36..c24eb77 100644 --- a/Makefile +++ b/Makefile @@ -56,7 +56,7 @@ release: -a cmd/gotron-builder/main.go @GOOS=windows GOARCH=amd64 CGO_ENABLED=0 \ - go build -o ./release/gotron-builder-amd64-win \ + go build -o ./release/gotron-builder-amd64-win.exe \ -ldflags="-X main.gotronBuilderVersion=$(VERSION)" \ -a cmd/gotron-builder/main.go diff --git a/gotron_methods.go b/gotron_methods.go index e3983d2..4c5b35e 100644 --- a/gotron_methods.go +++ b/gotron_methods.go @@ -56,11 +56,14 @@ func (gbw *BrowserWindow) CreateAppStructure(forceInstall ...bool) (err error) { } defer errz.Recover(&err) - //Copy Electron Files + err = os.MkdirAll(gbw.AppDirectory, 0777) + errz.Fatal(err) + + // Copy Electron Files err = gbw.copyElectronApplication(_forceInstall) errz.Fatal(err) - //Run npm install + // Run npm install err = gbw.runNPM(_forceInstall) errz.Fatal(err) @@ -139,15 +142,15 @@ func (gbw *BrowserWindow) copyElectronApplication(forceInstall bool) (err error) src, err := filepath.Abs(gbw.UIFolder) errz.Fatal(err) dst, err := filepath.Abs(filepath.Join(gbw.AppDirectory, "assets")) - errz.Fatal(err) - - if src != dst { - err = os.RemoveAll(filepath.Join(gbw.AppDirectory, "assets")) - errz.Fatal(err) - - err = copy.Copy(gbw.UIFolder, filepath.Join(gbw.AppDirectory, "assets")) - errz.Fatal(err) - } + errz.Fatal(err) + + if src != dst { + err = os.RemoveAll(filepath.Join(gbw.AppDirectory, "assets")) + errz.Fatal(err) + + err = copy.Copy(gbw.UIFolder, filepath.Join(gbw.AppDirectory, "assets")) + errz.Fatal(err) + } return nil }