Mercurial Hosting > editor
diff scripts/windows/launcher.vbs @ 75:7f5b3824f4d4
add Windows
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Wed, 18 Jun 2025 18:57:34 -0600 |
parents | |
children | 1beb4c57c269 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/windows/launcher.vbs Wed Jun 18 18:57:34 2025 -0600 @@ -0,0 +1,42 @@ +' test with: wscript launcher.vbs +' compile with: ISCC installer.iss + +url = "https://www.oracle.com/java/technologies/javase/javase8-archive-downloads.html" + +Set shell = CreateObject("WScript.Shell") + +' Try to read Oracle JDK install path from registry +On Error Resume Next +jdkHome = shell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit\1.8\JavaHome") +If jdkHome = "" Then + MsgBox "Oracle JDK 8 not found. Please install it from " & url, vbCritical, "Missing JDK" + shell.Run url + WScript.Quit 1 +End If +On Error GoTo 0 + +' Get the directory of this script +Set fso = CreateObject("Scripting.FileSystemObject") +scriptDir = fso.GetParentFolderName(WScript.ScriptFullName) + +' Build log path +logDir = shell.ExpandEnvironmentStrings("%LOCALAPPDATA%") & "\LuanEditor" +If Not fso.FolderExists(logDir) Then + fso.CreateFolder(logDir) +End If +logFile = logDir & "\error.log" + +configDir = shell.ExpandEnvironmentStrings("%APPDATA%") & "\LuanEditor" +If Not fso.FolderExists(configDir) Then + fso.CreateFolder(configDir) +End If +configFile = """" & configDir & "\config.json""" + +' Build and run the command +classpath = """" & scriptDir & "\jars\*.jar""" ' include all .jar files +dictionaries = """" & scriptDir & "\dictionaries\\""" +cmd = "cmd /c """"" & jdkHome & "\bin\java.exe"" -Dconfig=" & configFile & " -Ddictionaries=" & dictionaries & " -cp """ & scriptDir & "\jars\*"" luan.Luan classpath:luan_editor/editor.luan > """ & logFile & """ 2>&1""" +Set f = fso.OpenTextFile(logDir & "\debug_command.txt", 2, True) +f.WriteLine cmd +f.Close +shell.Run cmd, 0, False