mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-18 06:02:33 +00:00
update: Windows clippy baseline: cfg-gated imports in self_update and docs on the Windows MSI items
This commit is contained in:
@@ -30,8 +30,11 @@ pub(crate) fn string_tables(listed: &[(winsafe::LANGID, winsafe::co::CP)]) -> Ve
|
||||
|
||||
/// An MSI install found in the registry.
|
||||
pub struct MsiInstall {
|
||||
/// The product code, the registry key name under the uninstall list.
|
||||
pub product_code: String,
|
||||
/// The version the entry reports, when it has a readable one.
|
||||
pub version: Option<crate::version::Version>,
|
||||
/// The app's executable in the install folder, when it can be found.
|
||||
pub exe: Option<PathBuf>,
|
||||
}
|
||||
|
||||
@@ -95,6 +98,7 @@ fn exe_path(app: &App, location: Option<PathBuf>) -> Option<PathBuf> {
|
||||
exe_candidates(app, location.as_deref(), &roots).into_iter().find(|p| p.exists())
|
||||
}
|
||||
|
||||
/// The newest MSI install of `app` registered with the Windows Installer, if any.
|
||||
pub fn detect(app: &App) -> Option<Installed> {
|
||||
let m = msi_installs(app).into_iter().next()?;
|
||||
Some(Installed {
|
||||
|
||||
@@ -79,6 +79,8 @@ pub fn remove_product(product_code: &str, log: &Path) -> Result<(), String> {
|
||||
explain(status.code()).map_err(|e| format!("{e}. Its log is at {}", log.display()))
|
||||
}
|
||||
|
||||
/// Uninstalls every MSI install of `app` registered with the Windows Installer, one at a time, with a
|
||||
/// progress window and no restart. Fails when none is registered.
|
||||
pub fn uninstall_msi(app: &App, stop: &Stop, phase: &mut dyn FnMut(JobPhase)) -> Result<(), String> {
|
||||
let installs = crate::detect::windows::msi_installs(app);
|
||||
if installs.is_empty() {
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
|
||||
#[cfg(windows)]
|
||||
use super::helper::is_own_executable;
|
||||
use super::{App, Install, PackageKind, Path, PathBuf, Paths, Platform, Release, Version, pick_asset, process, version};
|
||||
use super::{App, Install, Path, PathBuf, Paths, Platform, Release, Version, pick_asset, version};
|
||||
#[cfg(target_os = "linux")]
|
||||
use super::{PackageKind, process};
|
||||
|
||||
/// Makes an installed copy believe it's this version, to try the self-update against the current
|
||||
/// release. The restart helper drops it, so it lasts one run.
|
||||
|
||||
@@ -8,7 +8,7 @@ use super::replace::is_plain_file;
|
||||
use super::replace::{mark_installed, unmark_unless_scheduled};
|
||||
use super::{App, OsString, Path, PathBuf, Paths, Version, install, version};
|
||||
#[cfg(windows)]
|
||||
use super::{Install, Release, Restart, process, update};
|
||||
use super::{Install, Release, Restart, process};
|
||||
|
||||
/// The first argument of the Windows update helper: a copy of this program that finishes an
|
||||
/// update once the launcher has exited (see [`finish`]).
|
||||
|
||||
@@ -1,10 +1,16 @@
|
||||
//! Swapping the running launcher for a new copy: AppImage, standalone tarball and release tree.
|
||||
|
||||
#[cfg(unix)]
|
||||
use super::App;
|
||||
use super::detect::marker;
|
||||
#[cfg(unix)]
|
||||
use super::detect::prefix_with_share;
|
||||
use super::helper::{done_file, failure_file, read_record};
|
||||
use super::{App, Path, PathBuf, Paths, Release, install};
|
||||
#[cfg(not(windows))]
|
||||
use super::helper::read_record;
|
||||
use super::helper::{done_file, failure_file};
|
||||
use super::{Path, Paths, Release};
|
||||
#[cfg(not(windows))]
|
||||
use super::{PathBuf, install};
|
||||
|
||||
/// Records `release` as just installed, so it isn't offered again for [`super::detect::JUST_UPDATED_FOR`]: its
|
||||
/// tag, the time, and the version it installs. The outcome records of an earlier update are
|
||||
|
||||
Reference in New Issue
Block a user