diff --git a/data/plugins/treeview.lua b/data/plugins/treeview.lua index 34c087a..00801fd 100644 --- a/data/plugins/treeview.lua +++ b/data/plugins/treeview.lua @@ -746,7 +746,12 @@ command.add( ["treeview:new-file"] = function(item) local text if not is_project_folder(item.abs_filename) then - text = item.filename .. PATHSEP + if item.type == "dir" then + text = item.filename .. PATHSEP + elseif item.type == "file" then + local parent_dir = common.dirname(item.filename) + text = parent_dir and parent_dir .. PATHSEP + end end core.command_view:enter("Filename", { text = text, @@ -768,7 +773,12 @@ command.add( ["treeview:new-folder"] = function(item) local text if not is_project_folder(item.abs_filename) then - text = item.filename .. PATHSEP + if item.type == "dir" then + text = item.filename .. PATHSEP + elseif item.type == "file" then + local parent_dir = common.dirname(item.filename) + text = parent_dir and parent_dir .. PATHSEP + end end core.command_view:enter("Folder Name", { text = text,