diff options
| author | tao <2471314@gmail.com> | 2026-07-01 20:25:21 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-07-01 08:25:21 -0400 |
| commit | fa9b3381bcf7d5cb91ba32aa83512e19b4965c3f (patch) | |
| tree | 300402025bc1095d5fc00768b109fffaede1e3ea /runtime/plugin/dir.lua | |
| parent | 05d70404251c8a7f728ad58ff99d3fab58cffdfb (diff) | |
| download | rneovim-fa9b3381bcf7d5cb91ba32aa83512e19b4965c3f.tar.gz rneovim-fa9b3381bcf7d5cb91ba32aa83512e19b4965c3f.tar.bz2 rneovim-fa9b3381bcf7d5cb91ba32aa83512e19b4965c3f.zip | |
feat(path): fnamemodify(':h') preserves logical root #40447
Problem:
On Windows, `fnamemodify('//foo/C$', ':h')` incorrectly removes `C$`
as a regular file name and returns `//foo`. However, this is a valid
UNC path, `foo` is a server name and `C$` is a share name.
The correct result should be `//foo/C$`.
Solution:
Extend `os_fileinfo2` and `FileInfo` with `prefix_off`, `rest_off` to
identify path types and logical root boundaries. ':h' can use this info
to prevent traversing past the logical root.
Examples:
/foo => /
//foo => // (POSIX)
//foo/bar => //foo (POSIX)
//server/share/foo => //server/share/ (Windows)
C:/foo => C:/
//?/C:/foo => //?/C:/
Co-authored-by: Barrett Ruth <br@barrettruth.com>
Diffstat (limited to 'runtime/plugin/dir.lua')
0 files changed, 0 insertions, 0 deletions