Skip to content

Commit

Permalink
fix: restarting the app would sometimes fail to start again
Browse files Browse the repository at this point in the history
  • Loading branch information
lwouis committed Jan 25, 2021
1 parent 96572a8 commit 56d47fc
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/ui/App.swift
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,10 @@ class App: AppCenterApplication, NSApplicationDelegate {
}

func restart() {
let url = URL(fileURLWithPath: Bundle.main.resourcePath!)
let path = url.deletingLastPathComponent().deletingLastPathComponent().absoluteString
let task = Process()
task.launchPath = "/usr/bin/open"
task.arguments = [path]
task.launch()
exit(0)
// we use -n to open a new instance, to avoid calling applicationShouldHandleReopen
// we use Bundle.main.bundlePath in case of multiple AltTab versions on the machine
Process.launchedProcess(launchPath: "/usr/bin/open", arguments: ["-n", Bundle.main.bundlePath])
App.shared.terminate(self)
}

func hideUi() {
Expand Down

0 comments on commit 56d47fc

Please sign in to comment.