Start work on opening files

This commit is contained in:
Max Brunsfeld
2021-04-28 17:46:27 -07:00
parent 3d6336b12a
commit 88b88a8067
6 changed files with 132 additions and 23 deletions
+6 -1
View File
@@ -18,11 +18,12 @@ use crate::{
worktree::FileHandle,
};
use anyhow::{anyhow, Result};
use gpui::{Entity, ModelContext};
use gpui::{AppContext, Entity, ModelContext};
use lazy_static::lazy_static;
use rand::prelude::*;
use std::{
cmp,
ffi::OsString,
hash::BuildHasher,
iter::{self, Iterator},
ops::{AddAssign, Range},
@@ -447,6 +448,10 @@ impl Buffer {
}
}
pub fn file_name(&self, ctx: &AppContext) -> Option<OsString> {
self.file.as_ref().and_then(|file| file.file_name(ctx))
}
pub fn path(&self) -> Option<Arc<Path>> {
self.file.as_ref().map(|file| file.path())
}