Skip to content

Commit e1b4bb4

Browse files
authored
fix(tangle): create missing dirs (#1644)
1 parent cd3056e commit e1b4bb4

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lua/neorg/modules/core/tangle/module.lua

+7-1
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,12 @@ module.on_event = function(event)
498498
local tangled_count = 0
499499

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

@@ -528,6 +533,7 @@ module.on_event = function(event)
528533
end)
529534
vim.uv.fs_close(fd)
530535
end)
536+
::continue::
531537
end
532538
end
533539
end

0 commit comments

Comments
 (0)