Simplify some statements. Don't convert path WinToUnix.

This commit is contained in:
Phil Runninger 2016-08-26 01:32:04 -04:00
parent 7730c8731a
commit 0b73db9368

View File

@ -174,23 +174,13 @@ function! s:Path.copy(dest)
call s:Path.createParentDirectories(a:dest) call s:Path.createParentDirectories(a:dest)
if !nerdtree#runningWindows() if exists('g:NERDTreeCopyCmd')
let dest = s:Path.WinToUnixPath(a:dest)
else
let dest = a:dest
endif
if !exists('g:NERDTreeCopyCmd')
if self.isDirectory
let cmd_prefix = g:NERDTreeCopyDirCmd
else
let cmd_prefix = g:NERDTreeCopyFileCmd
endif
else
let cmd_prefix = g:NERDTreeCopyCmd let cmd_prefix = g:NERDTreeCopyCmd
else
let cmd_prefix = (self.isDirectory ? g:NERDTreeCopyDirCmd : g:NERDTreeCopyFileCmd)
endif endif
let cmd = cmd_prefix . " " . escape(self.str(), self._escChars()) . " " . escape(dest, self._escChars()) let cmd = cmd_prefix . " " . escape(self.str(), self._escChars()) . " " . escape(a:dest, self._escChars())
let success = system(cmd) let success = system(cmd)
if v:shell_error != 0 if v:shell_error != 0
throw "NERDTree.CopyError: Could not copy ''". self.str() ."'' to: '" . a:dest . "'" throw "NERDTree.CopyError: Could not copy ''". self.str() ."'' to: '" . a:dest . "'"
@ -201,11 +191,7 @@ endfunction
" "
"returns 1 if copying is supported for this OS "returns 1 if copying is supported for this OS
function! s:Path.CopyingSupported() function! s:Path.CopyingSupported()
if !exists('g:NERDTreeCopyCmd') return exists('g:NERDTreeCopyCmd') || (exists('g:NERDTreeCopyDirCmd') && exists('g:NERDTreeCopyFileCmd'))
return exists('g:NERDTreeCopyDirCmd') && exists('g:NERDTreeCopyFileCmd')
endif
return 1
endfunction endfunction
"FUNCTION: Path.copyingWillOverwrite(dest) {{{1 "FUNCTION: Path.copyingWillOverwrite(dest) {{{1
@ -231,7 +217,7 @@ endfunction
"FUNCTION: Path.createParentDirectories(path) {{{1 "FUNCTION: Path.createParentDirectories(path) {{{1
" "
"create parent directories for this path if needed "create parent directories for this path if needed
"without throwing any errors is those directories already exist "without throwing any errors if those directories already exist
" "
"Args: "Args:
"path: full path of the node whose parent directories may need to be created "path: full path of the node whose parent directories may need to be created
@ -244,8 +230,7 @@ endfunction
"FUNCTION: Path.delete() {{{1 "FUNCTION: Path.delete() {{{1
" "
"Deletes the file represented by this path. "Deletes the file or directory represented by this path.
"Deletion of directories is not supported
" "
"Throws NERDTree.Path.Deletion exceptions "Throws NERDTree.Path.Deletion exceptions
function! s:Path.delete() function! s:Path.delete()