Fixed tests

This commit is contained in:
Mikayla Maki
2022-10-17 14:53:52 -07:00
parent f473eadf2d
commit 1789dfb8b1
6 changed files with 25 additions and 18 deletions
+4 -1
View File
@@ -583,7 +583,10 @@ impl Project {
cx: &mut gpui::TestAppContext,
) -> ModelHandle<Project> {
if !cx.read(|cx| cx.has_global::<Settings>()) {
cx.update(|cx| cx.set_global(Settings::test(cx)));
cx.update(|cx| {
cx.set_global(Settings::test(cx));
cx.set_global(HomeDir(Path::new("/tmp/").to_path_buf()))
});
}
let languages = Arc::new(LanguageRegistry::test());
+6 -2
View File
@@ -1840,23 +1840,27 @@ impl language::File for File {
fn full_path(&self, cx: &AppContext) -> PathBuf {
let mut full_path = PathBuf::new();
let worktree = self.worktree.read(cx);
if worktree.is_visible() {
full_path.push(worktree.root_name());
} else {
if let Some(path) = worktree.as_local().map(|local| local.abs_path.clone()) {
if let Ok(trimmed_path) = path.strip_prefix(cx.global::<HomeDir>().0.as_path()) {
if let Ok(trimmed_path) = path.strip_prefix(cx.global::<HomeDir>().as_path()) {
full_path.push("~");
full_path.push(trimmed_path);
} else {
full_path.push(path)
}
} else {
full_path.push(Path::new("/host-filesystem/"))
full_path.push(Path::new("/OUTSIDE_PROJECT"));
full_path.push(worktree.root_name());
}
}
if self.path.components().next().is_some() {
full_path.push(&self.path);
}
full_path
}