aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Odding <peter@peterodding.com>2011-08-31 23:22:55 +0200
committerPeter Odding <peter@peterodding.com>2011-08-31 23:22:55 +0200
commitdbab84bb2b37da40c27b6ade36920d2b96612ba5 (patch)
tree40693a90613c44ab84f89b3af7c042d7475e6970
parent1743275cba91ec6634722af32b7eae0e697bd277 (diff)
downloadvim-easytags-dbab84bb2b37da40c27b6ade36920d2b96612ba5.tar.gz
xolox#misc#path#is_relative()
-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()