Skip to content

Commit

Permalink
Fix node type resolution
Browse files Browse the repository at this point in the history
Fix node_type for directory with extension
  • Loading branch information
abhinavnatarajan committed May 3, 2024
1 parent ad8afa9 commit a48dae0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion src/lua/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ pub fn is_dir<'a>(util: Table<'a>, lua: &Lua) -> Result<Table<'a>> {
/// ```
pub fn is_file<'a>(util: Table<'a>, lua: &Lua) -> Result<Table<'a>> {
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)
}
Expand Down

0 comments on commit a48dae0

Please sign in to comment.