wrong behavior in creating new files on SMB shares from windows
Description
In a windows installation, a set of nested folders is wrongly created on a network (UNC) path when "a" is pressed to create a new file.
Neovim version
nvim 0.9.1
luajit 2.1.0-beta3
Operating system and version
Windows 11 pro 64
nvim-tree version
f873625
Minimal config
I do not have this information
Steps to reproduce
Opening a windows terminal with powershell prompt, I activate a dedicated python venv_nvim. (this is just my setup, unrelated to the issue).
I then change the current drive from C: to a network shared folder, on a windows server, which is mapped on M:
With cd I navigate to my target folder. and I launch "nvim ."
On the NvimTree windows I can see the full UNC path on the top, correctly written, without the mapped drive letter, in the form \server.subdomain.domain\path\my_folder
I can see the list of the existing files under the UNC path, with appropriate icons
I then press "a" to create a new file, and the prompt on the bottom correctly asks me the filename for the file to be created.
When I press <ENTER> the file is not created where expected, but within a new folder structure replicating the UNC path. The empty file is correctly created in the last nested folder.
I suspect an issue in processing the windows path separator "" that generates the creation of a set of nested folder.
This behavior is not correct.
Expected behavior
the new file should be created in the nv-tree folder where the cursor is when "a" is pressed. No nested folder creation is expected.
Actual behavior
nested folder structure is created. this is unexpected and unwanted. No errors are reported.
nvim-tree developers to not have access to nor expertise with windows. We do gratefully appreciate pull requests to resolve windows issues.
We will review the pull request but not test it.
Please:
- Ensure the new codepaths are behind the windows feature flags: https://github.com/nvim-tree/nvim-tree.lua/blob/034511714bacfadc5008e49f73fcef67e5613840/lua/nvim-tree/utils.lua#L10
- Test on the various windows setups: a. Powershell b. WSL c. cygwin