Class SystemHelper
- java.lang.Object
-
- org.libreoffice.ide.eclipse.core.model.utils.SystemHelper
-
public class SystemHelper extends java.lang.ObjectHelper class for system variables handling.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringPATH_SEPARATOR
-
Constructor Summary
Constructors Constructor Description SystemHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String[]addEnv(java.lang.String[] pEnv, java.lang.String pName, java.lang.String pValue, java.lang.String pSeparator)Add an environment variable to an array of existing variables.static java.lang.String[]addPathEnv(java.lang.String[] pEnv, java.lang.String pName, java.lang.String[] pValue)Add an environment variable to an array of existing variables.static java.io.FilegetFile(org.eclipse.core.resources.IResource pRes)Get a normal Java File from an Eclipse IResource.static java.io.FilegetFile(IUnoidlProject pPrj)Get a normal Java File from anIUnoidlProject.static java.lang.String[]getSystemEnvironement()static java.lang.ProcessrunTool(java.lang.String pShellCommand, java.lang.String[] pEnv, java.io.File pExecDir)Run a shell command with a given environment and an optional execution directory.static java.lang.ProcessrunToolWithSysEnv(java.lang.String pShellCommand, java.io.File pExecDir)Run a shell command with the system environment and an optional execution directory.
-
-
-
Method Detail
-
getFile
public static java.io.File getFile(org.eclipse.core.resources.IResource pRes)
Get a normal Java File from an Eclipse IResource.- Parameters:
pRes- the IResource to convert- Returns:
- the equivalent File
-
getFile
public static java.io.File getFile(IUnoidlProject pPrj)
Get a normal Java File from anIUnoidlProject.- Parameters:
pPrj-IUnoidlProjectto convert- Returns:
- the equivalent File
-
addPathEnv
public static java.lang.String[] addPathEnv(java.lang.String[] pEnv, java.lang.String pName, java.lang.String[] pValue)Add an environment variable to an array of existing variables.- Parameters:
pEnv- the array of existing environment variables where to add the new variablepName- the name of the variable to addpValue- the value of the variable to add- Returns:
- the completed array
-
addEnv
public static java.lang.String[] addEnv(java.lang.String[] pEnv, java.lang.String pName, java.lang.String pValue, java.lang.String pSeparator)Add an environment variable to an array of existing variables.- Parameters:
pEnv- the array of existing environment variables where to add the new variablepName- the name of the variable to addpValue- the value of the variable to addpSeparator- the separator to use if there is already a variable with the same name. Ifnull, the old variable will be replaced- Returns:
- the completed array
-
getSystemEnvironement
public static java.lang.String[] getSystemEnvironement()
- Returns:
- the system environment variables
-
runToolWithSysEnv
public static java.lang.Process runToolWithSysEnv(java.lang.String pShellCommand, java.io.File pExecDir) throws java.io.IOExceptionRun a shell command with the system environment and an optional execution directory.- Parameters:
pShellCommand- the command to runpExecDir- the execution directory ornullif none- Returns:
- the process for the running command
- Throws:
java.io.IOException- if anything wrong happens during the command launch
-
runTool
public static java.lang.Process runTool(java.lang.String pShellCommand, java.lang.String[] pEnv, java.io.File pExecDir) throws java.io.IOExceptionRun a shell command with a given environment and an optional execution directory.- Parameters:
pShellCommand- the command to runpEnv- the environment variablespExecDir- the execution directory ornullif none- Returns:
- the process for the running command
- Throws:
java.io.IOException- if anything wrong happens during the command launch
-
-