plenary.nvim icon indicating copy to clipboard operation
plenary.nvim copied to clipboard

Bug with `Path:mkdir()` on Windows

Open epwalsh opened this issue 2 years ago • 3 comments

This came up in https://github.com/epwalsh/obsidian.nvim/issues/88 and I think I've tracked it down to a bug with the path module here.

Running:

Path:new("C:/Users/myhome/my/local/obsidian/repo/"):mkdir { parents = true, exist_ok = true }

fails on Windows with

E5108: Error executing lua ...site\pack\packer\start\plenary.nvim/lua/plenary/path.lua:497: We couldn't mkdir: C:\Users\myhome\AppData\Local\nvim\lua\C:/Users/myhome/my/local/obsidian/repo/
stack traceback:
	[C]: in function 'error'
	...site\pack\packer\start\plenary.nvim/lua/plenary/path.lua:497: in function 'mkdir'
	[string ":source (no file)"]:601: in main chunk

Note that C:\Users\myhome\AppData\Local\nvim\lua is the path to the users configuration files where the call to mkdir() originates. So it looks like at some point mkdir() mangles the path by prepending this directory.

epwalsh avatar Feb 01 '23 18:02 epwalsh

Something similar happens in https://github.com/p00f/cphelper.nvim/issues/32, but instead of the nvim directory it appends it to C:\Users\myhome instead

p00f avatar Jun 02 '23 18:06 p00f

bump

bjjblackbelt avatar Mar 24 '24 21:03 bjjblackbelt

This issue has been fixed in https://github.com/nvim-lua/plenary.nvim/commit/8aad4396840be7fc42896e3011751b7609ca4119

drop-stones avatar Mar 25 '24 13:03 drop-stones