summaryrefslogtreecommitdiffstats
path: root/runtime/autoload/dist/vim9.vim
blob: 807140da7ca06b714f928c9351338b5fa4b6b234 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
vim9script

# Vim runtime support library
#
# Maintainer:	The Vim Project <https://github.com/vim/vim>
# Last Change:	2023 Oct 25

export def IsSafeExecutable(filetype: string, executable: string): bool
    var cwd = getcwd()
    return get(g:, filetype .. '_exec', get(g:, 'plugin_exec', 0))
      && (fnamemodify(exepath(executable), ':p:h') !=# cwd
          || (split($PATH, has('win32') ? ';' : ':')->index(cwd) != -1
              && cwd != '.'))
enddef

# Uncomment this line to check for compilation errors early
# defcompile