mirror of https://github.com/astral-sh/uv
Avoid error on relative paths in `uv tool uninstall` (#11889)
## Summary Closes https://github.com/astral-sh/uv/issues/11877.
This commit is contained in:
parent
8dd079f2ad
commit
cf76334d79
|
|
@ -75,7 +75,7 @@ impl InstalledTools {
|
||||||
/// 3. A directory in the local data directory, e.g., `./.uv/tools`
|
/// 3. A directory in the local data directory, e.g., `./.uv/tools`
|
||||||
pub fn from_settings() -> Result<Self, Error> {
|
pub fn from_settings() -> Result<Self, Error> {
|
||||||
if let Some(tool_dir) = std::env::var_os(EnvVars::UV_TOOL_DIR) {
|
if let Some(tool_dir) = std::env::var_os(EnvVars::UV_TOOL_DIR) {
|
||||||
Ok(Self::from_path(tool_dir))
|
Ok(Self::from_path(std::path::absolute(tool_dir)?))
|
||||||
} else {
|
} else {
|
||||||
Ok(Self::from_path(
|
Ok(Self::from_path(
|
||||||
StateStore::from_settings(None)?.bucket(StateBucket::Tools),
|
StateStore::from_settings(None)?.bucket(StateBucket::Tools),
|
||||||
|
|
|
||||||
|
|
@ -38,9 +38,9 @@ pub(crate) async fn uninstall(name: Vec<PackageName>, printer: Printer) -> Resul
|
||||||
fs_err::tokio::remove_dir_all(&installed_tools.root())
|
fs_err::tokio::remove_dir_all(&installed_tools.root())
|
||||||
.await
|
.await
|
||||||
.ignore_currently_being_deleted()?;
|
.ignore_currently_being_deleted()?;
|
||||||
if let Some(top_level) = installed_tools.root().parent() {
|
if let Some(parent) = installed_tools.root().parent() {
|
||||||
if uv_fs::directories(top_level).all(|path| uv_fs::is_temporary(&path)) {
|
if uv_fs::directories(parent).all(|path| uv_fs::is_temporary(&path)) {
|
||||||
fs_err::tokio::remove_dir_all(top_level)
|
fs_err::tokio::remove_dir_all(parent)
|
||||||
.await
|
.await
|
||||||
.ignore_currently_being_deleted()?;
|
.ignore_currently_being_deleted()?;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue