fix: correctly parse the directory of a given path to a file
The previous `gsub` call would blow away everything after and including the first '/' in the pathname, including other slashes. Fortunately, the neovim api provides a way to get the parent directory of a given path, which I've used instead.remotes/origin/HEAD
parent
b46b5c33cb
commit
231a9da8f3
|
|
@ -96,7 +96,7 @@ local function fileOp(op)
|
|||
-- DETERMINE PATH AND EXTENSION
|
||||
local hasPath = newName:find("/")
|
||||
if hasPath then
|
||||
local newFolder = newName:gsub("/.-$", "")
|
||||
local newFolder = vim.fs.dirname(newName)
|
||||
fn.mkdir(newFolder, "p") -- create folders if necessary
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue