Skip to content

Cleanup directories handling #765

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 8 commits into from
Feb 10, 2023
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Some code make-up
  • Loading branch information
cmaglie committed Feb 10, 2023
commit 2d1378980ec54b878026282cdbf61d13415fca3d
18 changes: 6 additions & 12 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,25 +147,19 @@ func main() {
ConfigDir: configDir,
}

path, err := os.Executable()
if err != nil {
panic(err)
}

// If the executable is temporary, copy it to the full path, then restart
if strings.Contains(path, "-temp") {
newPath := updater.BinPath(path)
err := copyExe(path, newPath)
if err != nil {
if src, err := os.Executable(); err != nil {
panic(err)
} else if strings.Contains(src, "-temp") {
newPath := updater.BinPath(src)
if err := copyExe(src, newPath); err != nil {
log.Println("Copy error: ", err)
panic(err)
}

Systray.Update(newPath)
} else {
// Otherwise copy to a path with -temp suffix
err := copyExe(path, updater.TempPath(path))
if err != nil {
if err := copyExe(src, updater.TempPath(src)); err != nil {
panic(err)
}
Systray.Start()
Expand Down