From f130922744657b731c24a842a85fd8a9f8058073 Mon Sep 17 00:00:00 2001 From: tao <2471314@gmail.com> Date: Sat, 25 Apr 2026 01:20:25 +0800 Subject: fix(path): normalize path slashes on Windows #37729 Problem: On Windows, path separators may become inconsistent for various reasons, which makes normalization quite painful. Solution: Normalize paths to `/` at the entry boundaries and always use it internally, converting back only in rare cases where `\` is really needed (e.g. cmd.exe/bat scripts?). This is the first commit in a series of incremental steps. Note: * some funcs won't respect shellslash. e.g. `expand/fnamemodify` * some funcs still respect shellslash, but will be updated in a follow PR. e.g. `ex_pwd/f_chdir/f_getcwd` * uv's built-in funcs always return `\`. e.g. `uv.cwd/uv.exepath` Co-authored-by: Justin M. Keyes --- test/functional/vimscript/executable_spec.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'test/functional/vimscript/executable_spec.lua') diff --git a/test/functional/vimscript/executable_spec.lua b/test/functional/vimscript/executable_spec.lua index 943e2e10d0..bb52c861f0 100644 --- a/test/functional/vimscript/executable_spec.lua +++ b/test/functional/vimscript/executable_spec.lua @@ -19,13 +19,13 @@ describe('executable()', function() end) if is_os('win') then - it('exepath respects shellslash', function() + it('exepath returns consistent slashes #13787', function() -- test/ cannot be a symlink in this test. n.api.nvim_set_current_dir(t.paths.test_source_path) command('let $PATH = fnamemodify("./test/functional/fixtures/bin", ":p")') eq( - [[test\functional\fixtures\bin\null.CMD]], + [[test/functional/fixtures/bin/null.CMD]], call('fnamemodify', call('exepath', 'null'), ':.') ) command('set shellslash') @@ -35,12 +35,12 @@ describe('executable()', function() ) end) - it('stdpath respects shellslash', function() + it('stdpath returns consistent slashes #13787', function() -- Needs to check paths relative to repo root dir. n.api.nvim_set_current_dir(t.paths.test_source_path) t.matches( - [[build\Xtest_xdg[%w_]*\share\nvim%-data]], + [[build/Xtest_xdg[%w_]*/share/nvim%-data]], call('fnamemodify', call('stdpath', 'data'), ':.') ) command('set shellslash') -- cgit