Skip to content

Commit

Permalink
fix(tangle): create missing dirs (#1644)
Browse files Browse the repository at this point in the history
  • Loading branch information
benlubas authored Feb 6, 2025
1 parent cd3056e commit e1b4bb4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lua/neorg/modules/core/tangle/module.lua
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,12 @@ module.on_event = function(event)
local tangled_count = 0

for file, content in pairs(tangles) do
file = dirman_utils.expand_pathlib(file, true):tostring()
file = dirman_utils.expand_pathlib(file, true)
if not file then goto continue end
if not file:parent():exists() then
file:parent():mkdir(Path.permission("rwxr-xr-x"), true)
end
file = file:tostring()
vim.loop.fs_open(file, "w", 438, function(err, fd)
assert(not err and fd, lib.lazy_string_concat("Failed to open file '", file, "' for tangling: ", err))

Expand Down Expand Up @@ -528,6 +533,7 @@ module.on_event = function(event)
end)
vim.uv.fs_close(fd)
end)
::continue::
end
end
end
Expand Down

0 comments on commit e1b4bb4

Please sign in to comment.