aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--path.vim15
1 files changed, 14 insertions, 1 deletions
diff --git a/path.vim b/path.vim
index 2b4510f..ee0f2e2 100644
--- a/path.vim
+++ b/path.vim
@@ -1,6 +1,6 @@
" Vim auto-load script
" Author: Peter Odding <peter@peterodding.com>
-" Last Change: March 15, 2011
+" Last Change: August 31, 2011
" URL: http://peterodding.com/code/vim/misc/
let s:windows_compatible = has('win32') || has('win64')
@@ -69,6 +69,7 @@ endfunction
" Join a directory and filename into a single pathname.
function! xolox#misc#path#merge(parent, child, ...)
+ " TODO Use isabs()!
if type(a:parent) == type('') && type(a:child) == type('')
if s:windows_compatible
let parent = substitute(a:parent, '[\\/]\+$', '', '')
@@ -127,6 +128,18 @@ else
endfunction
endif
+" Check whether a path is relative.
+
+function! xolox#misc#path#is_relative(path)
+ if a:path =~ '^\w\+://'
+ return 0
+ elseif s:windows_compatible
+ return a:path !~ '^\(\w:\|[\\/]\)'
+ else
+ return a:path !~ '^/'
+ endif
+endfunction
+
" Create a temporary directory and return the path.
function! xolox#misc#path#tempdir()