-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Added feature to perform in-place update of Drifty (#562)
* feat: Added ability to perform in-place update of drifty * fix: fixed Linter issue * fix: fixed Drifty GUI downloading wrong update file and also fixed some minor CLI issues * fix: fixed CWE-248 - NumberFormatException raised by CodeQL * feat: Added support for updating Drifty GUI and CLI based on architecture (`amd64`/`x86_64` or `aarch64`) for macOS * style: format codebase * fix(CI): Fixed linter issue * debug: Added debug window to pop-up for windows msi if there's a lack in permission * debug: Added debug window to pop-up for windows msi if there's a lack in permission * fix: Fixed delay in updating Drifty GUI when the download queue is not empty * fix: Fixed delay in updating Drifty GUI when the download queue is not empty * debug: Added debug window to pop-up for windows msi if there's a lack in permission * debug: Removed debug window as write permissions are apparently available * fix: Fixed the usage of temporary drifty update directory for future downloads * debug: Moved log file to a visible area for better monitoring of update of drifty in windows * debug: Moved log file to a visible area for better monitoring of update of drifty in windows * debug: Narrow down the update failure to the code for replacing executables * debug: Narrow down the update failure to the code for replacing executables * debug: Added log instructions to get an idea of the permissions available * fix: Fixed permission detection for windows msi * fix: Fixed permission detection for windows, linux and mac (for mac, only in case of CLI) to prevent failure in in-place update of Drifty * fix(CI): Fixed linter issue * style: format codebase * fix: Fixed NullPointerException while creating log during initialization * fix: Fixed unchecked admin privileges during initialization period of Drifty CLI * fix: Added a copy instead of move for Windows update check * fix: Added `deleteOnExit()` command to delete '.old' executable for windows * fix: Added a fix for exe update in windows * fix(CI): Fixed linter issues * fix: the old exe will get deleted now and added check for update menu item * chore: Removed the resizability of confirmation dialog * chore: Removed unnecessary code lines previously added for debug purposes * style: format codebase * fix: Fixed CoderabbitAI's reviews * fix: Fixed CoderabbitAI's reviews * chore: Removed the version number modification previously made solely for testing purposes --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
772a996
commit e9c7e0e
Showing
36 changed files
with
967 additions
and
167 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package cli.updater; | ||
|
||
import java.io.File; | ||
|
||
public class CLIUpdateExecutor extends updater.UpdateExecutor { | ||
public CLIUpdateExecutor(File currentExecutableFile, File latestExecutableFile) { | ||
super(currentExecutableFile, latestExecutableFile); | ||
} | ||
|
||
@Override | ||
public boolean execute() { | ||
M.msgLogInfo("Setting executable permission for the latest version of Drifty..."); | ||
if (setLatestExecutablePermissions()) { | ||
M.msgLogInfo("Executable permission set! Executing update..."); | ||
} else { | ||
M.msgUpdateError("Failed to set executable permission for the latest version of Drifty!"); | ||
return false; | ||
} | ||
cleanup(true); // This will delete the old executable created previously | ||
if (renameCurrentExecutable()) { | ||
if (replaceCurrentExecutable()) { | ||
cleanup(false); | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.