fix(update): report the newest known version, not just the compiled one
Trusting the version compiled into the binary alone made the app report a stale release whenever the build predated a version bump: `version` is read at configure time, and bumping it is not by itself a reason to configure again, so `cmake --build` kept the previous number compiled in while the marker it installed next to the binary said otherwise. The update was then offered again even though it had just been applied. The version file is now a configure dependency, so a bump reconfigures the build, and the reported version is the newest of the two sources, so neither side can drag the app backwards. Generated with Codebuff 🤖 Co-Authored-By: Codebuff <noreply@codebuff.com>
This commit is contained in:
1 parent
fb5c11e153
commit
5216480d81
6 files changed
+75
-31
No files matched your search
@@ -26,11 +26,17 @@ class UpdateManager : public QObject {
|
||||
public:
|
||||
explicit UpdateManager(QObject* parent = nullptr);
|
||||
|
||||
// Current app version, compiled in from the repo-root `version` file (see
|
||||
// CMakeLists.txt), falling back to the `version` file installed next to the
|
||||
// executable when the build bypassed CMake.
|
||||
// Current app version: the newest of the version compiled in from the
|
||||
// repo-root `version` file (see CMakeLists.txt) and the one recorded in the
|
||||
// `version` file installed next to the executable.
|
||||
static QString currentVersion();
|
||||
|
||||
// Highest of two dotted versions. Used to reconcile the two places that know
|
||||
// the version: either can lag behind (a build made without configuring
|
||||
// again, or a marker left by an older install), and reporting the lower one
|
||||
// would offer an already installed release for ever.
|
||||
static QString newestVersion(const QString& a, const QString& b);
|
||||
|
||||
// Path of the state file storing the last check date and the latest
|
||||
// known remote version (e.g. ~/.local/share/PacManager/update-state.json).
|
||||
static QString stateFilePath();
|
||||
|
||||
Reference in new issue
Block a user