Fix tests
This commit is contained in:
parent
fd72f4526d
commit
929a9f97b2
1 changed files with 9 additions and 2 deletions
|
@ -26,8 +26,15 @@ pub fn init(assets: impl AssetSource, cx: &mut AppContext) {
|
||||||
|
|
||||||
impl FileAssociations {
|
impl FileAssociations {
|
||||||
pub fn new(assets: impl AssetSource) -> Self {
|
pub fn new(assets: impl AssetSource) -> Self {
|
||||||
let file = assets.load("icons/file_icons/file_types.json").unwrap();
|
assets
|
||||||
serde_json::from_str::<FileAssociations>(str::from_utf8(&file).unwrap()).unwrap()
|
.load("icons/file_icons/file_types.json")
|
||||||
|
.map(|file| {
|
||||||
|
serde_json::from_str::<FileAssociations>(str::from_utf8(&file).unwrap()).unwrap()
|
||||||
|
})
|
||||||
|
.unwrap_or_else(|_| FileAssociations {
|
||||||
|
suffixes: HashMap::default(),
|
||||||
|
types: HashMap::default(),
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_icon(path: &Path, cx: &AppContext) -> Option<Arc<str>> {
|
pub fn get_icon(path: &Path, cx: &AppContext) -> Option<Arc<str>> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue