Fixed shellslash problems in Windows

This commit is contained in:
kyouryuukunn 2018-09-09 19:45:38 +09:00
parent db4e2d5cf3
commit 0ad960d478
3 changed files with 10 additions and 1 deletions

View File

@ -128,6 +128,7 @@ function! vebugger#gdb#_readWhere(pipeName,line,readResult,debugger)
let l:matches=matchlist(a:line,'\v^\*stopped.*fullname\=\"([^"]+)\",line\=\"(\d+)"') let l:matches=matchlist(a:line,'\v^\*stopped.*fullname\=\"([^"]+)\",line\=\"(\d+)"')
if 2<len(l:matches) if 2<len(l:matches)
let l:file=has('win32') ? substitute(l:matches[1], '\\\\', '\\', 'g') : l:matches[1] let l:file=has('win32') ? substitute(l:matches[1], '\\\\', '\\', 'g') : l:matches[1]
let l:file=vebugger#util#WinShellSlash(l:file)
let l:file=fnamemodify(l:file,':p') let l:file=fnamemodify(l:file,':p')
let a:readResult.std.location={ let a:readResult.std.location={
\'file':(l:file), \'file':(l:file),

View File

@ -59,7 +59,7 @@ function! vebugger#pdb#_readWhere(pipeName,line,readResult,debugger)
let l:matches=matchlist(a:line,'\v^\> (.+)\((\d+)\).*\(\)%(-\>.*)?$') let l:matches=matchlist(a:line,'\v^\> (.+)\((\d+)\).*\(\)%(-\>.*)?$')
if 2<len(l:matches) if 2<len(l:matches)
let l:file=l:matches[1] let l:file=vebugger#util#WinShellSlash(l:matches[1])
if !empty(glob(l:file)) if !empty(glob(l:file))
let l:line=str2nr(l:matches[2]) let l:line=str2nr(l:matches[2])
let a:readResult.std.location={ let a:readResult.std.location={

View File

@ -116,6 +116,14 @@ function! vebugger#util#isPathAbsolute(path)
endif endif
endfunction endfunction
function! vebugger#util#WinShellSlash(path)
if has('win32') && &shellslash
return substitute(a:path, '\\', '/', 'g')
else
return a:path
endif
endfunction
function! vebugger#util#listify(stringOrList) function! vebugger#util#listify(stringOrList)
if type(a:stringOrList) == type([]) if type(a:stringOrList) == type([])
return copy(a:stringOrList) " so it could safely be modified by map&filter return copy(a:stringOrList) " so it could safely be modified by map&filter