Skip to content

Commit

Permalink
Taught s:Path.getParent to handle Windows paths.
Browse files Browse the repository at this point in the history
There was an error in the function which prevented Windows paths
from being properly decoded.  This error was causing the ".. (up a dir)"
feature to fail due to an unhandled Invalid Argument exception.

Signed-off-by: Tim Henigan <tim.henigan@gmail.com>
  • Loading branch information
thenigan committed Sep 8, 2009
1 parent e2265ec commit f8c69aa
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion plugin/NERD_tree.vim
Original file line number Diff line number Diff line change
Expand Up @@ -2009,7 +2009,12 @@ endfunction
"Return:
"a new Path object
function! s:Path.getParent()
let path = '/'. join(self.pathSegments[0:-2], '/')
if s:running_windows
let path = self.drive . '\' . join(self.pathSegments[0:-2], '\')
else
let path = '/'. join(self.pathSegments[0:-2], '/')
endif

return s:Path.New(path)
endfunction
"FUNCTION: Path.getLastPathComponent(dirSlash) {{{3
Expand Down

0 comments on commit f8c69aa

Please sign in to comment.