mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-23 12:50:04 +08:00
Merge pull request #1288 from SpaceVim/project_manager
Fix project manager
This commit is contained in:
commit
b1b8a354c3
@ -122,7 +122,7 @@ function! s:find_root_directory() abort
|
||||
else
|
||||
let dir = SpaceVim#util#findFileInParent(pattern, fd)
|
||||
endif
|
||||
if !empty(dir)
|
||||
if !empty(dir) && isdirectory(dir)
|
||||
let dir = fnamemodify(dir, ':p')
|
||||
call SpaceVim#logger#info("Find project root('" . pattern . "','" . fd . "'):" . dir)
|
||||
call add(dirs, dir)
|
||||
@ -133,12 +133,11 @@ endfunction
|
||||
|
||||
|
||||
function! s:sort_dirs(dirs) abort
|
||||
let dirs = sort(a:dirs, funcref('s:compare'))
|
||||
let dir = get(sort(a:dirs, funcref('s:compare')), 0, '')
|
||||
let bufdir = getbufvar('%', 'rootDir', '')
|
||||
if bufdir ==# get(dirs, 0, '')
|
||||
if bufdir ==# dir
|
||||
return ''
|
||||
else
|
||||
let dir = dirs[0]
|
||||
if isdirectory(dir)
|
||||
let dir = fnamemodify(dir, ':p:h:h')
|
||||
else
|
||||
@ -155,7 +154,7 @@ function! s:compare(d1, d2) abort
|
||||
endfunction
|
||||
|
||||
function! s:change_to_root_directory() abort
|
||||
if s:find_root_directory()
|
||||
if !empty(s:find_root_directory())
|
||||
call SpaceVim#plugins#projectmanager#RootchandgeCallback()
|
||||
endif
|
||||
return getbufvar('%', 'rootDir', '')
|
||||
|
Loading…
Reference in New Issue
Block a user