diff options
author | Famiu Haque <famiuhaque@proton.me> | 2024-04-17 01:13:44 +0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-16 12:13:44 -0700 |
commit | 8e5c48b08dad54706500e353c58ffb91f2684dd3 (patch) | |
tree | ad297ac49606935943b376ed89c0f7c20671f08e /src/nvim/lua/stdlib.c | |
parent | 20b38677c22b0ff19ea54396c7718b5a8f410ed4 (diff) | |
download | rneovim-8e5c48b08dad54706500e353c58ffb91f2684dd3.tar.gz rneovim-8e5c48b08dad54706500e353c58ffb91f2684dd3.tar.bz2 rneovim-8e5c48b08dad54706500e353c58ffb91f2684dd3.zip |
feat(lua): vim.fs.normalize() resolves ".", ".." #28203
Problem:
`vim.fs.normalize` does not resolve `.` and `..` components. This makes
no sense as the entire point of normalization is to remove redundancy
from the path. The path normalization functions in several other
languages (Java, Python, C++, etc.) also resolve `.` and `..`
components.
Reference:
- Python: https://docs.python.org/3/library/os.path.html#os.path.normpath
- Java: https://docs.oracle.com/javase/8/docs/api/java/nio/file/Path.html#normalize--
- C++: https://en.cppreference.com/w/cpp/filesystem/path/lexically_normal
Solution:
Resolve "." and ".." in `vim.fs.normalize`.
Before:
"~/foo/bar/../baz/./" => "~/foo/bar/../baz/."
After:
"~/foo/bar/../baz/./" => "~/foo/baz"
Diffstat (limited to 'src/nvim/lua/stdlib.c')
0 files changed, 0 insertions, 0 deletions