Check the entire path in `TreeView` `new-file` and `new-folder` commands

This commit is contained in:
Guldoman 2021-11-30 01:11:35 +01:00
parent 718ab209f5
commit a0afd077a2
No known key found for this signature in database
GPG Key ID: C08A498EC7F1AFDD
1 changed files with 4 additions and 6 deletions

View File

@ -507,9 +507,8 @@ command.add(function() return view.hovered_item ~= nil end, {
end,
["treeview:new-file"] = function()
local dir_name = view.hovered_item.filename
if not is_project_folder(dir_name) then
core.command_view:set_text(dir_name .. "/")
if not is_project_folder(view.hovered_item.abs_filename) then
core.command_view:set_text(view.hovered_item.filename .. "/")
end
core.command_view:enter("Filename", function(filename)
local doc_filename = core.project_dir .. PATHSEP .. filename
@ -522,9 +521,8 @@ command.add(function() return view.hovered_item ~= nil end, {
end,
["treeview:new-folder"] = function()
local dir_name = view.hovered_item.filename
if not is_project_folder(dir_name) then
core.command_view:set_text(dir_name .. "/")
if not is_project_folder(view.hovered_item.abs_filename) then
core.command_view:set_text(view.hovered_item.filename .. "/")
end
core.command_view:enter("Folder Name", function(filename)
local dir_path = core.project_dir .. PATHSEP .. filename