mirror of https://github.com/astral-sh/uv
Ignore empty directory if not allow_existing
This commit is contained in:
parent
f0151f3a18
commit
00882e31fc
|
|
@ -95,18 +95,17 @@ pub(crate) fn create(
|
|||
OnExisting::Allow => {
|
||||
debug!("Allowing existing {name} due to `--allow-existing`");
|
||||
}
|
||||
OnExisting::Remove => {
|
||||
debug!("Removing existing {name} due to `--clear`");
|
||||
remove_virtualenv(location)?;
|
||||
fs::create_dir_all(location)?;
|
||||
}
|
||||
OnExisting::Fail
|
||||
if location
|
||||
_ if location
|
||||
.read_dir()
|
||||
.is_ok_and(|mut dir| dir.next().is_none()) =>
|
||||
{
|
||||
debug!("Ignoring empty directory");
|
||||
}
|
||||
OnExisting::Remove => {
|
||||
debug!("Removing existing {name} due to `--clear`");
|
||||
remove_virtualenv(location)?;
|
||||
fs::create_dir_all(location)?;
|
||||
}
|
||||
OnExisting::Fail => {
|
||||
match confirm_clear(location, name)? {
|
||||
Some(true) => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue