mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-07 02:57:34 +00:00
Allow guests to create directories
This commit is contained in:
parent
40e0f10195
commit
509ede0e80
2 changed files with 29 additions and 6 deletions
|
@ -1899,6 +1899,33 @@ mod tests {
|
||||||
[".zed.toml", "a.txt", "b.txt", "d.txt"]
|
[".zed.toml", "a.txt", "b.txt", "d.txt"]
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
project_b
|
||||||
|
.update(cx_b, |project, cx| {
|
||||||
|
project
|
||||||
|
.create_entry((worktree_id, "DIR"), true, cx)
|
||||||
|
.unwrap()
|
||||||
|
})
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
|
worktree_a.read_with(cx_a, |worktree, _| {
|
||||||
|
assert_eq!(
|
||||||
|
worktree
|
||||||
|
.paths()
|
||||||
|
.map(|p| p.to_string_lossy())
|
||||||
|
.collect::<Vec<_>>(),
|
||||||
|
[".zed.toml", "DIR", "a.txt", "b.txt", "d.txt"]
|
||||||
|
);
|
||||||
|
});
|
||||||
|
worktree_b.read_with(cx_b, |worktree, _| {
|
||||||
|
assert_eq!(
|
||||||
|
worktree
|
||||||
|
.paths()
|
||||||
|
.map(|p| p.to_string_lossy())
|
||||||
|
.collect::<Vec<_>>(),
|
||||||
|
[".zed.toml", "DIR", "a.txt", "b.txt", "d.txt"]
|
||||||
|
);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#[gpui::test(iterations = 10)]
|
#[gpui::test(iterations = 10)]
|
||||||
|
|
|
@ -3829,12 +3829,8 @@ impl Project {
|
||||||
.ok_or_else(|| anyhow!("worktree not found"))?;
|
.ok_or_else(|| anyhow!("worktree not found"))?;
|
||||||
worktree.update(cx, |worktree, cx| {
|
worktree.update(cx, |worktree, cx| {
|
||||||
let worktree = worktree.as_local_mut().unwrap();
|
let worktree = worktree.as_local_mut().unwrap();
|
||||||
if envelope.payload.is_directory {
|
let path = PathBuf::from(OsString::from_vec(envelope.payload.path));
|
||||||
unimplemented!("can't yet create directories");
|
anyhow::Ok(worktree.create_entry(path, envelope.payload.is_directory, cx))
|
||||||
} else {
|
|
||||||
let path = PathBuf::from(OsString::from_vec(envelope.payload.path));
|
|
||||||
anyhow::Ok(worktree.write_file(path, Default::default(), cx))
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
})?
|
})?
|
||||||
.await?;
|
.await?;
|
||||||
|
|
Loading…
Reference in a new issue