runtime(termdebug): gdb file/folder check is now performed only in CWD.

Commit: 
https://github.com/vim/vim/commit/2736cc725d26c4bd13c7faee2d6d0ff9d0568acc
Author: Ubaldo Tiberi <ubaldo.tib...@google.com>
Date:   Wed Jul 17 20:16:02 2024 +0200

    runtime(termdebug): gdb file/folder check is now performed only in CWD.
    
    closes: https://github.com/vim/vim/issues/15268
    
    Signed-off-by: Ubaldo Tiberi <ubaldo.tib...@google.com>
    Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim 
b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
index c6db92cef..83bcda17d 100644
--- a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
+++ b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
@@ -223,6 +223,11 @@ enddef
 
 def SanityCheck(): bool
   var gdb_cmd = GetCommand()[0]
+  var cwd = $'{getcwd()}/'
+  if exists('+shellslash') && !&shellslash
+    # on windows, need to handle backslash
+    cwd->substitute('\', '/', 'g')
+  endif
   var is_check_ok = true
   # Need either the +terminal feature or +channel and the prompt buffer.
   # The terminal feature does not work with gdb on win32.
@@ -230,11 +235,11 @@ def SanityCheck(): bool
     err = 'Cannot debug, +channel feature is not supported'
   elseif (way is Way.Prompt) && !exists('*prompt_setprompt')
     err = 'Cannot debug, missing prompt buffer support'
-  elseif (way is Way.Prompt) && !empty(glob(gdb_cmd))
+  elseif (way is Way.Prompt) && !empty(glob($'{cwd}{gdb_cmd}'))
     err = $"You have a file/folder named '{gdb_cmd}' in the current directory 
Termdebug may not work properly. Please exit and rename such a file/folder."
-  elseif !empty(glob(asmbufname))
+  elseif !empty(glob($'{cwd}{asmbufname}'))
     err = $"You have a file/folder named '{asmbufname}' in the current 
directory Termdebug may not work properly. Please exit and rename such a 
file/folder."
-  elseif !empty(glob(varbufname))
+  elseif !empty(glob($'{cwd}{varbufname}'))
     err = $"You have a file/folder named '{varbufname}' in the current 
directory Termdebug may not work properly. Please exit and rename such a 
file/folder."
   elseif !executable(gdb_cmd)
     err = $"Cannot execute debugger program '{gdb_cmd}'"

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/E1sU9Pg-00ABCU-VU%40256bit.org.

Raspunde prin e-mail lui