diff options
author | _ <a@b.co> | 2020-11-13 17:41:03 +0530 |
---|---|---|
committer | _ <a@b.co> | 2020-11-13 17:41:03 +0530 |
commit | 36f4c05a3162f747d45d7edd0664cf954cfcab32 (patch) | |
tree | e069d6cee687d2ae70cae547af2a3d2aab27504a /src/tree | |
parent | 131d436283f085fd20ce1813ddffd66deebfb4c2 (diff) |
Add double extensions support.
Forgot earlier.
Diffstat (limited to 'src/tree')
-rw-r--r-- | src/tree/tree_line.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/tree/tree_line.rs b/src/tree/tree_line.rs index e30cf4d..3e9d361 100644 --- a/src/tree/tree_line.rs +++ b/src/tree/tree_line.rs @@ -54,11 +54,13 @@ impl TreeLine { Some( icon_plugin ) => { let extension = Self::extension_from_name( name ); + let double_extension = Self::double_extension_from_name( name ); + let icon = &icon_plugin.get_icon( tree_line_type, path, &name, - Some( "" ), + double_extension, extension, ); @@ -68,6 +70,13 @@ impl TreeLine { } } + pub fn double_extension_from_name( name: &str ) -> Option<&str> { + regex!( r"\.([^.]+\.[^.]+)" ) + .captures(&name) + .and_then(|c| c.get(1)) + .map(|e| e.as_str()) + } + pub fn extension_from_name( name: &str ) -> Option<&str> { regex!(r"\.([^.]+)$") .captures(&name) |