Closed rktjmp closed 1 year ago
Calling uv.fs_realpath
will expand the path. We can either call this when we first generate the cache prefix, or (and?) call it everywhere. I am vaguely hesitant of calling it everywhere because it will convert symlink paths to their ... real paths, which might not be what we want for cache readability, or for files that get relinked a lot. We also must take care to call it first, then normalise everytime, else we end up with backslash paths.
Note also fs_realpath
can return nil if the file does not exist, where as normalise will just "clean up" a path.
Windows has a max path length of 260 chars and will truncate long user names to
6~N
names, sorunneradmin
becomesRUNNER~1
.We do not have any control over when these paths are given to us, and when we request
stdpath("cache")
it can return in this form depending on the system setup (username, etc).This has a few issues:
RUNNER~1
in them.stdpath("cache")
, meaning our paths cant match and we cant find the index file. Eg:C:/Users/RUNNER~1/temp
cache .. "/.../x.lua"
, egC:/Users/RUNNNER~1/temp/.../x.lua
C:/Users/runneradmin/temp/.../x.lua != C:/Users/RUNNER~1/temp.../x.lua
RTP initially, with RUNNER~1,
nvim_get_runtime_file "" true
nvim_get_runtime_file "lua/abc.lua" true
, no resultsForce replace
RUNNER~1
withrunneradmin
,File is found: