utility function to check if running on Windows platform

This commit is contained in:
Alan Hamlett 2017-04-13 00:19:37 -07:00
parent 2f5c426b8c
commit ee7854b171

View file

@ -152,6 +152,13 @@ let s:VERSION = '4.0.14'
return join(safeArgs, ' ') return join(safeArgs, ' ')
endfunction endfunction
function! s:IsWindows()
if has('win32') || has('win64')
return s:true
endif
return s:false
endfunction
function! s:SendHeartbeat(file, time, is_write, last) function! s:SendHeartbeat(file, time, is_write, last)
let file = a:file let file = a:file
if file == '' if file == ''
@ -159,7 +166,7 @@ let s:VERSION = '4.0.14'
endif endif
if file != '' if file != ''
let python_bin = g:wakatime_PythonBinary let python_bin = g:wakatime_PythonBinary
if has('win32') || has('win64') if s:IsWindows()
if python_bin == 'python' if python_bin == 'python'
let python_bin = 'pythonw' let python_bin = 'pythonw'
endif endif
@ -180,7 +187,7 @@ let s:VERSION = '4.0.14'
if s:is_debug_mode_on if s:is_debug_mode_on
echo 'Sending Heartbeat with Command: ' . s:JoinArgs(cmd) echo 'Sending Heartbeat with Command: ' . s:JoinArgs(cmd)
endif endif
if has('win32') || has('win64') if s:IsWindows()
exec 'silent !start /min cmd /c "' . s:JoinArgs(cmd) . '"' exec 'silent !start /min cmd /c "' . s:JoinArgs(cmd) . '"'
else else
let stdout = system(s:JoinArgs(cmd) . ' &') let stdout = system(s:JoinArgs(cmd) . ' &')