summaryrefslogtreecommitdiff
path: root/mnv/runtime/autoload/dist/mnv.mnv
blob: 6e14895d28a5073d100e5f72b518d9865cca5bc8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
" MNV runtime support library,
" runs the MNV9 script version or legacy script version
" on demand (mostly for Neomnv compatibility)
"
" Maintainer:	The MNV Project <https://github.com/Project-Tick/Project-Tick>
" Last Change:	2026 Jan 11


" enable the zip and gzip plugin by default, if not set
if !exists('g:zip_exec')
  let g:zip_exec = 1
endif

if !exists('g:gzip_exec')
  let g:gzip_exec = 1
endif

if !has('mnv9script')
  function dist#mnv#IsSafeExecutable(filetype, executable)
    let cwd = getcwd()
    if empty(exepath(a:executable))
      return v:false
    endif
    return get(g:, a:filetype .. '_exec', get(g:, 'plugin_exec', 0)) &&
          \ (fnamemodify(exepath(a:executable), ':p:h') !=# cwd
          \ || (split($PATH, has('win32') ? ';' : ':')->index(cwd) != -1 &&
          \  cwd != '.'))
  endfunction

  finish
endif

def dist#mnv#IsSafeExecutable(filetype: string, executable: string): bool
  return dist#mnv9#IsSafeExecutable(filetype, executable)
enddef