Skip to content

Commit

Permalink
fix: Fixed app name in macos
Browse files Browse the repository at this point in the history
  • Loading branch information
SaptarshiSarkar12 committed Feb 16, 2024
1 parent ab6de7c commit 8f09cce
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions GUI/src/main/java/ui/UIController.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ private void downloadUpdate() {
File currentExecutable = currentExecutablePath.toFile();
String customDirectory = getDir();
Path tmpFolder = Files.createTempDirectory("Drifty").toAbsolutePath();
Job updateJob = new Job(Constants.updateURL.toString(), tmpFolder.toString(), currentExecutablePath.getFileName().toString(), false);
String latestExecutableName = OS.isMac() ? "Drifty_GUI.pkg" : currentExecutable.getName();
Job updateJob = new Job(Constants.updateURL.toString(), tmpFolder.toString(), latestExecutableName, false);
addJob(updateJob);
Thread downloadUpdate = new Thread(batchDownloader());
downloadUpdate.start();
Expand All @@ -112,13 +113,13 @@ private void downloadUpdate() {
setDir(customDirectory);
if (OS.isMac()) {
try {
File pkg = new File(tmpFolder.toString(), currentExecutablePath.getFileName().toString());
File pkg = new File(tmpFolder.toString(), latestExecutableName);
boolean isExecutable = pkg.setExecutable(true);
if (!isExecutable) {
M.msgUpdateError("Failed to set the pkg file as executable!");
new ConfirmationDialog("Update Failed", "Failed to set the pkg file as executable!", true, true).getResponse();
}
String argument = Paths.get(tmpFolder.toString(), currentExecutablePath.getFileName().toString()).toAbsolutePath().toString();
String argument = Paths.get(tmpFolder.toString(), latestExecutableName).toAbsolutePath().toString();
// new ConfirmationDialog("PKG start command", "The command is " + nl.repeat(2) + "open" + argument).getResponse();
// M.msgUpdateInfo("The command is " + nl.repeat(2) + "open" + argument);
new ProcBuilder("open").withArgs(argument).withNoTimeout().ignoreExitStatus().run();
Expand Down

0 comments on commit 8f09cce

Please sign in to comment.