Skip to content

Commit

Permalink
Merge pull request #24 from Equanox/fix_permissions
Browse files Browse the repository at this point in the history
fix permission bug with .gotron dir
  • Loading branch information
Equanox authored Feb 12, 2019
2 parents 621452f + c251fc8 commit 3cb89ba
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
25 changes: 14 additions & 11 deletions gotron_methods.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 3cb89ba

Please sign in to comment.