1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-03 02:10:05 +08:00

Fix configuration file path (#4200)

This commit is contained in:
Wang Shidong 2021-05-31 23:30:44 +08:00 committed by GitHub
parent 8c6a828986
commit 738dbdf580
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -228,18 +228,30 @@ endfunction
let s:file['updateFiles'] = function('s:updatefiles')
" this function should return a unify path
" This function will run resolve too
" CHANGED: This function will not run resolve
" 1. the sep is /
" 2. if it is a dir, end with /
" 3. if a:path end with /, then return path also end with /
function! s:unify_path(path, ...) abort
call SpaceVim#logger#info('a:path is :' . a:path)
let mod = a:0 > 0 ? a:1 : ':p'
let path = s:vim_comp.resolve(fnamemodify(a:path, mod . ':gs?[\\/]?/?'))
let path = fnamemodify(a:path, mod . ':gs?[\\/]?/?')
call SpaceVim#logger#info('a:path is :' . a:path)
call SpaceVim#logger#info('path is :' . path)
if isdirectory(path) && path[-1:] !=# '/'
call SpaceVim#logger#info('case one')
call SpaceVim#logger#info('a:path is :' . a:path)
call SpaceVim#logger#info('path is :' . path)
return path . '/'
elseif a:path[-1:] ==# '/' && path[-1:] !=# '/'
call SpaceVim#logger#info('case two')
call SpaceVim#logger#info('a:path is :' . a:path)
call SpaceVim#logger#info('path is :' . path)
return path . '/'
else
call SpaceVim#logger#info('case three')
call SpaceVim#logger#info('a:path is :' . a:path)
call SpaceVim#logger#info('path is :' . path)
return path
endif
endfunction