summaryrefslogtreecommitdiffstats
path: root/runtime/pack/dist/opt/editorconfig/tests/core/editorconfig1.vbs
blob: 488411fcf8f14d011d06471096bb59faceb6125c (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
36
37
38
39
' editorconfig1.vbs: run by editorconfig.bat
' runs editorconfig2.ps1
' Part of editorconfig-core-vimscript and editorconfig-vim.
'
' Copyright (c) 2018--2019 Chris White.  All rights reserved.
' Licensed CC-BY-SA, version 3.0 or any later version, at your option.
'
' Modified from
' https://stackoverflow.com/a/2470557/2877364 by
' https://stackoverflow.com/users/2441/aphoria

' Thanks to https://www.geekshangout.com/vbs-script-to-get-the-location-of-the-current-script/
currentScriptPath = Replace(WScript.ScriptFullName, WScript.ScriptName, "")

' Load our common library.  Thanks to https://stackoverflow.com/a/316169/2877364
With CreateObject("Scripting.FileSystemObject")
   executeGlobal .openTextFile(currentScriptPath & "ecvbslib.vbs").readAll()
End With

' === MAIN ==================================================================

' Encode all the arguments as modified base64 so there will be no quoting
' issues when we invoke powershell.
b64args = MakeY64Args(Wscript.Arguments)

' Quote script name just in case
ps1name = QuoteForShell(currentScriptPath & "editorconfig2.ps1")
'Wscript.Echo "Script is in " & ps1name

if True then
    retval = RunCommandAndEcho( "powershell.exe" & _
        " -executionpolicy bypass -file " & ps1name & " " & join(b64args) _
    )
        ' add -noexit to leave window open so you can see error messages

    WScript.Quit retval
end if

' vi: set ts=4 sts=4 sw=4 et ai: