Skip to content

Commit

Permalink
Clean import paths from last character if it's a path separator
Browse files Browse the repository at this point in the history
  • Loading branch information
idanarye committed Aug 19, 2014
1 parent bedac4f commit a1d320d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion autoload/dutyl/configFile.vim
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ let s:functions={}
function! s:functions.importPaths() dict abort
let l:result=exists('g:dutyl_stdImportPaths') ? copy(g:dutyl_stdImportPaths) : []
let l:result=extend(l:result,s:readConfigFile().importPaths)
return l:result
return map(l:result,'dutyl#util#cleanPathFromLastCharacterIfPathSeparator(v:val)')
endfunction

"Return a Vim Dictionary of the configuration in the configuration file
Expand Down
2 changes: 1 addition & 1 deletion autoload/dutyl/dub.vim
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function! s:functions.importPaths() dict abort
endfor
endfor

return l:result
return map(l:result,'dutyl#util#cleanPathFromLastCharacterIfPathSeparator(v:val)')
endfunction

"Calls 'dub describe' and turns the result to Vim's data types
Expand Down
9 changes: 9 additions & 0 deletions autoload/dutyl/util.vim
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,12 @@ function! dutyl#util#isPathAbsolute(path) abort
endif
endfunction

"Exactly what it says on the tin
function! dutyl#util#cleanPathFromLastCharacterIfPathSeparator(path) abort
let l:lastCharacter=a:path[len(a:path)-1]
if '/'==l:lastCharacter || '\'==l:lastCharacter
return a:path[0:-2]
else
return a:path
endif
endfunction

0 comments on commit a1d320d

Please sign in to comment.