Class SysUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic Stringstatic StringResolves the Java launcher used to spawn a JVM tool (JMT, LDES).static Stringstatic StringjlqnGetPath(String jlqnPath) static StringLocates an existingJMT.jar, downloading nothing.static StringLocatesJMT.jar.static StringjmtGetPath(String jmtPath) static Stringstatic StringlineTempName(String solverName) static StringlineTempName(String solverName, boolean mountable) AslineTempName(String), but whenmountableis true the workspace is rooted under$HOME/.lineinstead of the system temp dir.static Stringstatic voidremoveDirectory(Path dirPath) splitCommand(String cmd) Splits a command line into an argument vector, keeping a double-quoted span together.static Stringstatic String
-
Method Details
-
getRootFolder
-
jlqnGetPath
-
jlqnGetPath
-
javaLauncher
Resolves the Java launcher used to spawn a JVM tool (JMT, LDES).Resolution order:
$LINE_JAVA;$JAVA_HOME/bin/java; the JVM running this code (java.home); then the bare namejava, left to PATH. Thejava.homestep matters where PATH carries no java at all, which is the common case on Windows: a process already inside a JVM always has one launcher it can name.- Returns:
- an absolute launcher path, or "java" when only PATH can answer
-
jmtGetPath
LocatesJMT.jar.Resolution order:
$LINE_JMT_JAR; the directory of the running jar and its ancestors; then the working directory and its ancestors; then the per-user cache. A candidate counts only whenJMT.jaris actually in it. The walk used to accept the first ancestor merely NAMEDcommon, so an emptypython/commonshadowed the realcommon/for every invocation whose cwd was underpython/and the CLI went off to download 50MB instead. See_kb/12-interfaces-and-docs.md.When nothing is found the jar is downloaded, to the installation's
common/when that is writable and to the per-user cache when it is not, so that a read-only or shared installation still works. UsejmtFindPath()to ask whether JMT is present without fetching it.- Returns:
- the path of JMT.jar, existing where one was found
-
jmtFindPath
Locates an existingJMT.jar, downloading nothing.The search half of
jmtGetPath(), split out so that a caller that only wants to KNOW whether JMT is installed -- the environment check ofjline.cli.LineInstall-- does not trigger the 50MB fetch as a side effect of asking. MATLAB'slineInstallcallsjmtGetPathfor this and does download; the question and the acquisition are kept apart here.- Returns:
- the path of an existing JMT.jar, or null when there is none
-
jmtGetPath
-
lineViewerGetPath
-
system
-
splitCommand
Splits a command line into an argument vector, keeping a double-quoted span together.Splitting on whitespace alone tore apart every path with a space in it, which on Windows is where both the JVM (
C:\Program Files\...\java.exe) and the model normally live.- Parameters:
cmd- the command line- Returns:
- its arguments, with the quotes removed
-
system
-
lineTempName
- Throws:
IOException
-
lineTempName
- Throws:
IOException
-
lineTempName
AslineTempName(String), but whenmountableis true the workspace is rooted under$HOME/.lineinstead of the system temp dir. Snap-confined Docker cannot bind-mount the system temp dir (typically/tmp), so solvers that dispatch through Docker request a HOME-based, mount-accessible location (mirrors the MATLABlineTempName).- Throws:
IOException
-
removeDirectory
- Throws:
IOException
-