Skip to content

Commit

Permalink
fix: touch MISE_DATA_DIR after uninstall (#2919)
Browse files Browse the repository at this point in the history
triggers hook-env execution

Fixes #2876
  • Loading branch information
jdx authored Nov 4, 2024
1 parent 174f74b commit e697dad
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 0 additions & 1 deletion src/backend/external_plugin_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ impl ExternalPluginCache {
None => tv.cache_path().join("list_bin_paths.msgpack.z"),
};
CacheManagerBuilder::new(list_bin_paths_filename)
.with_fresh_file(dirs::DATA.to_path_buf())
.with_fresh_file(plugin.plugin_path.clone())
.with_fresh_file(tv.install_path())
.build()
Expand Down
5 changes: 3 additions & 2 deletions src/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use eyre::Result;
use flate2::read::ZlibDecoder;
use flate2::write::ZlibEncoder;
use flate2::Compression;
use itertools::Itertools;
use once_cell::sync::{Lazy, OnceCell};
use serde::de::DeserializeOwned;
use serde::Serialize;
Expand Down Expand Up @@ -44,7 +45,7 @@ impl CacheManagerBuilder {
Self {
cache_file_path: cache_file_path.as_ref().to_path_buf(),
cache_keys: BASE_CACHE_KEYS.clone(),
fresh_files: Vec::new(),
fresh_files: vec![dirs::DATA.to_path_buf()],
fresh_duration: None,
}
}
Expand Down Expand Up @@ -173,7 +174,7 @@ where

fn freshest_duration(&self) -> Option<Duration> {
let mut freshest = self.fresh_duration;
for path in &self.fresh_files {
for path in self.fresh_files.iter().unique() {
let duration = modified_duration(path).unwrap_or_default();
freshest = Some(match freshest {
None => duration,
Expand Down
3 changes: 2 additions & 1 deletion src/cli/uninstall.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::cli::args::ToolArg;
use crate::config::Config;
use crate::toolset::{ToolRequest, ToolSource, ToolVersion, ToolsetBuilder};
use crate::ui::multi_progress_report::MultiProgressReport;
use crate::{backend, lockfile, runtime_symlinks, shims};
use crate::{backend, dirs, file, lockfile, runtime_symlinks, shims};

/// Removes installed tool versions
///
Expand Down Expand Up @@ -67,6 +67,7 @@ impl Uninstall {
}
}

file::touch_dir(&dirs::DATA)?;
lockfile::update_lockfiles(&[]).wrap_err("failed to update lockfiles")?;
let ts = ToolsetBuilder::new().build(&config)?;
shims::reshim(&ts, false).wrap_err("failed to reshim")?;
Expand Down

0 comments on commit e697dad

Please sign in to comment.