From 14b7c60b456d04d3edddbdcc3d55221da0271524 Mon Sep 17 00:00:00 2001 From: Matteo Quintiliani Date: Mon, 4 Jan 2016 22:57:33 +0100 Subject: [PATCH] Improve xolox#misc#path#equals() for case-insensitive filesystem --- autoload/xolox/misc/path.vim | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/autoload/xolox/misc/path.vim b/autoload/xolox/misc/path.vim index 6ff5589..a6a39fe 100644 --- a/autoload/xolox/misc/path.vim +++ b/autoload/xolox/misc/path.vim @@ -226,15 +226,23 @@ endfunction " xolox#misc#path#equals(a, b) - Check whether two pathnames point to the same file. {{{1 -if s:windows_compatible - function! xolox#misc#path#equals(a, b) +function! xolox#misc#path#equals(a, b) + " Set default value for case_insensitive_filesystem based on OS + if s:windows_compatible + let case_insensitive_filesystem = 1 + else + let case_insensitive_filesystem = 0 + endif + " Set value from g:xolox#misc#case_insensitive_filesystem if it exists + if exists('g:xolox#misc#case_insensitive_filesystem') + let case_insensitive_filesystem = (g:xolox#misc#case_insensitive_filesystem == 1)? 1 : 0 + endif + if case_insensitive_filesystem == 1 return a:a ==? a:b || xolox#misc#path#absolute(a:a) ==? xolox#misc#path#absolute(a:b) - endfunction -else - function! xolox#misc#path#equals(a, b) + else return a:a ==# a:b || xolox#misc#path#absolute(a:a) ==# xolox#misc#path#absolute(a:b) - endfunction -endif + endif +endfunction function! xolox#misc#path#is_relative(path) " {{{1 " Returns true (1) when the pathname given as the first argument is