-
Notifications
You must be signed in to change notification settings - Fork 8
Feature/updater #272
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
Feature/updater #272
Conversation
- Doesn't work if the OS does not allow deleting of the file while the timesheet generator is still running
- Tested on Windows 11 and MacOS Tahoe 26.1
|
is sonarqube broken? |
robinmaisch
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not easy to test the new feature, but it is looking good :)
If you can change this one thing, we are ready.
|
|
I have spent a good amount of time testing it on (mainly) macOS and Windows, everything should work, as long as the releases are always names v0.1.2 or just 0.1.2 |



Updater
This pull request adds what I've been wanting to add for quite some time: Updating.
Now, when the TimesheetGenerator is started, it will compare the latest online version to the version listed in its pom.xml. If the online version is newer (not equal, obviously), the TimesheetGenerator will prompt the user if they wish to update. If they do, the process is like this:
3.1. Move the newly downloaded jar to where the old jar once was, copying the name and everything
3.2. Start the new TimesheetGenerator and close the current one via System.exit(0).
4.1. In this case, it gets a little bit more complicated: First, open the new temp jar file and tell it that it is an updater and the current real TimesheetGenerator filepath. After that, close.
4.2. The temp file will attempt to delete the file at the given path. If its not possible within 10 seconds, it times out and exits.
4.3. If successful, the temp file will copy itself to where the TimesheetGenerator was, launch that one, and kill itself.
4.4. The temp file will be deleted anyway through either starting the TimesheetGenerator immediately after, or the next time, so there is no need to worry about it.
Image of the prompt:
Additionally, all temporary jar files that follow the naming pattern are erased when starting the TimesheetGenerator UI.