From a48dae008c47465184bf1b8fbe5dbcd6b36eb1de Mon Sep 17 00:00:00 2001 From: Abhinav Natarajan Date: Fri, 3 May 2024 03:23:18 +0100 Subject: [PATCH] Fix node type resolution Fix node_type for directory with extension --- src/config.rs | 2 +- src/lua/util.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/config.rs b/src/config.rs index 27ceeaf..5f34a32 100644 --- a/src/config.rs +++ b/src/config.rs @@ -104,7 +104,7 @@ impl NodeTypesConfig { node_type = node_type.extend(conf); } - if let Some(conf) = self.extension.get(&node.extension) { + if let (Some(conf), false) = (self.extension.get(&node.extension), node.is_dir) { node_type = node_type.extend(conf); } diff --git a/src/lua/util.rs b/src/lua/util.rs index 63abbe9..6d761e3 100644 --- a/src/lua/util.rs +++ b/src/lua/util.rs @@ -160,7 +160,7 @@ pub fn is_dir<'a>(util: Table<'a>, lua: &Lua) -> Result> { /// ``` pub fn is_file<'a>(util: Table<'a>, lua: &Lua) -> Result> { let func = - lua.create_function(move |_, path: String| Ok(PathBuf::from(path).is_dir()))?; + lua.create_function(move |_, path: String| Ok(PathBuf::from(path).is_file()))?; util.set("is_file", func)?; Ok(util) }