Skip to content

fix permission bug with .gotron dir #24

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

Merged
merged 1 commit into from
Feb 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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