Skip to content

Commit

Permalink
Bug fix: Encode ":" on Mac OS X in xolox#misc#path#encode()
Browse files Browse the repository at this point in the history
Reported here: #28
  • Loading branch information
xolox committed Apr 18, 2013
1 parent 9b4c774 commit b88ab45
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions path.vim
@@ -1,9 +1,10 @@
" Vim auto-load script
" Author: Peter Odding <peter@peterodding.com>
" Last Change: September 26, 2011
" Last Change: April 18, 2013
" URL: http://peterodding.com/code/vim/misc/

let s:windows_compatible = has('win32') || has('win64')
let s:mac_os_x_compatible = has('macunix')

function! xolox#misc#path#which(...)
let extensions = s:windows_compatible ? split($PATHEXT, ';') : ['']
Expand Down Expand Up @@ -129,7 +130,13 @@ endfunction
" Encode a pathname so it can be used as a filename.

function! xolox#misc#path#encode(path)
let mask = s:windows_compatible ? '[*|\\/:"<>?%]' : '[\\/%]'
if s:windows_compatible
let mask = '[*|\\/:"<>?%]'
elseif s:mac_os_x_compatible
let mask = '[\\/%:]'
else
let mask = '[\\/%]'
endif
return substitute(a:path, mask, '\=printf("%%%x", char2nr(submatch(0)))', 'g')
endfunction

Expand Down

0 comments on commit b88ab45

Please sign in to comment.