Correctly check existence of target directory in copy_recursive function (#6875)

Fixes https://github.com/zed-industries/zed/issues/6778

Release Notes:

- Fixed issue where copy-paste for folders was not working in the
project panel
([#6778](https://github.com/zed-industries/zed/issues/6778)).
This commit is contained in:
George Munyoro 2024-01-29 12:06:02 +02:00 committed by GitHub
parent 9ef830e9bb
commit 49542757fd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 96 additions and 1 deletions

View file

@ -1183,7 +1183,7 @@ pub fn copy_recursive<'a>(
.await?
.ok_or_else(|| anyhow!("path does not exist: {}", source.display()))?;
if metadata.is_dir {
if !options.overwrite && fs.metadata(target).await.is_ok() {
if !options.overwrite && fs.metadata(target).await.is_ok_and(|m| m.is_some()) {
if options.ignore_if_exists {
return Ok(());
} else {