Add a function that checks if a path is full or relative

This commit is contained in:
IdanArye 2014-06-09 21:36:38 +03:00
parent ef56a809d0
commit ff2a8207d8

View File

@ -94,3 +94,12 @@ function! vebugger#util#getToolFullPath(toolName,default)
return a:default return a:default
endif endif
endfunction endfunction
"Checks if the path is an absolute path
function! vebugger#util#isPathAbsolute(path)
if has('win32')
return a:path=~':' || a:path[0]=='%' "Absolute paths in Windows contain : or start with an environment variable
else
return a:path[0]=~'\v^[/~$]' "Absolute paths in Linux start with ~(home),/(root dir) or $(environment variable)
endif
endfunction