1
0
Эх сурвалжийг харах

Error message for old location libs

Strahinja Val Markovic 11 жил өмнө
parent
commit
f1cf9186cb
1 өөрчлөгдсөн 19 нэмэгдсэн , 9 устгасан
  1. 19 9
      plugin/youcompleteme.vim

+ 19 - 9
plugin/youcompleteme.vim

@@ -43,26 +43,36 @@ elseif !has( 'python' )
 endif
 
 let s:script_folder_path = escape( expand( '<sfile>:p:h' ), '\' )
+let s:python_folder_path = s:script_folder_path . '/../python/'
+let s:ycmd_folder_path = s:script_folder_path . '/../third_party/ycmd'
 
-function! s:HasYcmCore()
-  let path_prefix = s:script_folder_path . '/../python/'
-  if filereadable(path_prefix . 'ycm_client_support.so') &&
-        \ filereadable(path_prefix . 'ycm_core.so')
+function! s:YcmLibsPresentIn( path_prefix )
+  if filereadable(a:path_prefix . 'ycm_client_support.so') &&
+        \ filereadable(a:path_prefix . 'ycm_core.so')
     return 1
-  elseif filereadable(path_prefix . 'ycm_client_support.pyd') &&
-        \ filereadable(path_prefix . 'ycm_core.pyd')
+  elseif filereadable(a:path_prefix . 'ycm_client_support.pyd') &&
+        \ filereadable(a:path_prefix . 'ycm_core.pyd')
     return 1
-  elseif filereadable(path_prefix . 'ycm_client_support.dll') &&
-        \ filereadable(path_prefix . 'ycm_core.dll')
+  elseif filereadable(a:path_prefix . 'ycm_client_support.dll') &&
+        \ filereadable(a:path_prefix . 'ycm_core.dll')
     return 1
   endif
   return 0
 endfunction
 
+if s:YcmLibsPresentIn( s:python_folder_path )
+  echohl WarningMsg |
+        \ echomsg "YCM libraries found in old location; please RECOMPILE YCM." |
+        \ echohl None
+  call s:restore_cpo()
+  finish
+endif
+
 let g:ycm_check_if_ycm_core_present =
       \ get( g:, 'ycm_check_if_ycm_core_present', 1 )
 
-if g:ycm_check_if_ycm_core_present && !s:HasYcmCore()
+if g:ycm_check_if_ycm_core_present &&
+      \ !s:YcmLibsPresentIn( s:ycmd_folder_path )
   echohl WarningMsg |
         \ echomsg "ycm_client_support.[so|pyd|dll] and " .
         \ "ycm_core.[so|pyd|dll] not detected; you need to compile " .