Mercurial Hosting > editor
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 74:c3b0fba5c2bc | 75:7f5b3824f4d4 |
|---|---|
| 1 ' test with: wscript launcher.vbs | |
| 2 ' compile with: ISCC installer.iss | |
| 3 | |
| 4 url = "https://www.oracle.com/java/technologies/javase/javase8-archive-downloads.html" | |
| 5 | |
| 6 Set shell = CreateObject("WScript.Shell") | |
| 7 | |
| 8 ' Try to read Oracle JDK install path from registry | |
| 9 On Error Resume Next | |
| 10 jdkHome = shell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit\1.8\JavaHome") | |
| 11 If jdkHome = "" Then | |
| 12 MsgBox "Oracle JDK 8 not found. Please install it from " & url, vbCritical, "Missing JDK" | |
| 13 shell.Run url | |
| 14 WScript.Quit 1 | |
| 15 End If | |
| 16 On Error GoTo 0 | |
| 17 | |
| 18 ' Get the directory of this script | |
| 19 Set fso = CreateObject("Scripting.FileSystemObject") | |
| 20 scriptDir = fso.GetParentFolderName(WScript.ScriptFullName) | |
| 21 | |
| 22 ' Build log path | |
| 23 logDir = shell.ExpandEnvironmentStrings("%LOCALAPPDATA%") & "\LuanEditor" | |
| 24 If Not fso.FolderExists(logDir) Then | |
| 25 fso.CreateFolder(logDir) | |
| 26 End If | |
| 27 logFile = logDir & "\error.log" | |
| 28 | |
| 29 configDir = shell.ExpandEnvironmentStrings("%APPDATA%") & "\LuanEditor" | |
| 30 If Not fso.FolderExists(configDir) Then | |
| 31 fso.CreateFolder(configDir) | |
| 32 End If | |
| 33 configFile = """" & configDir & "\config.json""" | |
| 34 | |
| 35 ' Build and run the command | |
| 36 classpath = """" & scriptDir & "\jars\*.jar""" ' include all .jar files | |
| 37 dictionaries = """" & scriptDir & "\dictionaries\\""" | |
| 38 cmd = "cmd /c """"" & jdkHome & "\bin\java.exe"" -Dconfig=" & configFile & " -Ddictionaries=" & dictionaries & " -cp """ & scriptDir & "\jars\*"" luan.Luan classpath:luan_editor/editor.luan > """ & logFile & """ 2>&1""" | |
| 39 Set f = fso.OpenTextFile(logDir & "\debug_command.txt", 2, True) | |
| 40 f.WriteLine cmd | |
| 41 f.Close | |
| 42 shell.Run cmd, 0, False |
