diff --git a/libclide/src/fs.rs b/libclide/src/fs.rs index 484ea1e..aaee11e 100644 --- a/libclide/src/fs.rs +++ b/libclide/src/fs.rs @@ -4,15 +4,4 @@ pub mod entry_meta; -use devicons::FileIcon; -use std::path::Path; - -pub fn icon>(p: P) -> FileIcon { - let path = p.as_ref(); - if Path::new(&path).is_dir() { - // Ensures directories are given a folder icon and not mistakenly resolved to a language. - // For example, a directory named `cpp` would otherwise return a C++ icon. - return FileIcon::from("dir/"); - } - FileIcon::from(path) -} +pub use entry_meta::icon; diff --git a/libclide/src/fs/entry_meta.rs b/libclide/src/fs/entry_meta.rs index 55749c9..148df0b 100644 --- a/libclide/src/fs/entry_meta.rs +++ b/libclide/src/fs/entry_meta.rs @@ -52,3 +52,13 @@ impl EntryMeta { }) } } + +pub fn icon>(p: P) -> FileIcon { + let path = p.as_ref(); + if Path::new(&path).is_dir() { + // Ensures directories are given a folder icon and not mistakenly resolved to a language. + // For example, a directory named `cpp` would otherwise return a C++ icon. + return FileIcon::from("dir/"); + } + FileIcon::from(path) +}