D. Ben Knoble | cd8a3ea | 2023-11-04 05:11:17 -0400 | [diff] [blame^] | 1 | vim9script |
| 2 | |
| 3 | # Vim runtime support library |
| 4 | # |
| 5 | # Maintainer: The Vim Project <https://github.com/vim/vim> |
| 6 | # Last Change: 2023 Oct 25 |
| 7 | |
| 8 | export def IsSafeExecutable(filetype: string, executable: string): bool |
| 9 | var cwd = getcwd() |
| 10 | return get(g:, filetype .. '_exec', get(g:, 'plugin_exec', 0)) |
| 11 | && (fnamemodify(exepath(executable), ':p:h') !=# cwd |
| 12 | || (split($PATH, has('win32') ? ';' : ':')->index(cwd) != -1 |
| 13 | && cwd != '.')) |
| 14 | enddef |
| 15 | |
| 16 | # Uncomment this line to check for compilation errors early |
| 17 | # defcompile |