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 => {
|
OnExisting::Allow => {
|
||||||
debug!("Allowing existing {name} due to `--allow-existing`");
|
debug!("Allowing existing {name} due to `--allow-existing`");
|
||||||
}
|
}
|
||||||
OnExisting::Remove => {
|
_ if location
|
||||||
debug!("Removing existing {name} due to `--clear`");
|
|
||||||
remove_virtualenv(location)?;
|
|
||||||
fs::create_dir_all(location)?;
|
|
||||||
}
|
|
||||||
OnExisting::Fail
|
|
||||||
if location
|
|
||||||
.read_dir()
|
.read_dir()
|
||||||
.is_ok_and(|mut dir| dir.next().is_none()) =>
|
.is_ok_and(|mut dir| dir.next().is_none()) =>
|
||||||
{
|
{
|
||||||
debug!("Ignoring empty directory");
|
debug!("Ignoring empty directory");
|
||||||
}
|
}
|
||||||
|
OnExisting::Remove => {
|
||||||
|
debug!("Removing existing {name} due to `--clear`");
|
||||||
|
remove_virtualenv(location)?;
|
||||||
|
fs::create_dir_all(location)?;
|
||||||
|
}
|
||||||
OnExisting::Fail => {
|
OnExisting::Fail => {
|
||||||
match confirm_clear(location, name)? {
|
match confirm_clear(location, name)? {
|
||||||
Some(true) => {
|
Some(true) => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue