本文整理汇总了Java中com.intellij.execution.configurations.PathEnvironmentVariableUtil类的典型用法代码示例。如果您正苦于以下问题:Java PathEnvironmentVariableUtil类的具体用法?Java PathEnvironmentVariableUtil怎么用?Java PathEnvironmentVariableUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PathEnvironmentVariableUtil类属于com.intellij.execution.configurations包,在下文中一共展示了PathEnvironmentVariableUtil类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findExecutable
import com.intellij.execution.configurations.PathEnvironmentVariableUtil; //导入依赖的package包/类
@NotNull
protected static String findExecutable(@NotNull String programName,
@NotNull String unixExec,
@NotNull String winExec,
@NotNull Collection<String> envs) {
String exec = findEnvValue(programName, envs);
if (exec != null) {
return exec;
}
File fileExec = PathEnvironmentVariableUtil.findInPath(SystemInfo.isWindows ? winExec : unixExec);
if (fileExec != null) {
return fileExec.getAbsolutePath();
}
throw new IllegalStateException(programName + " executable not found. " + (envs.size() > 0 ?
"Please define a valid environment variable " +
envs.iterator().next() +
" pointing to the " +
programName +
" executable." : ""));
}
示例2: suggestSdkDirectoryPathFromEnv
import com.intellij.execution.configurations.PathEnvironmentVariableUtil; //导入依赖的package包/类
@Nullable
private static String suggestSdkDirectoryPathFromEnv() {
File fileFromPath = PathEnvironmentVariableUtil.findInPath(SquirrelConstants.SQUIRREL_COMPILER_NAME);
if (fileFromPath != null) {
File canonicalFile;
try {
canonicalFile = fileFromPath.getCanonicalFile();
String path = canonicalFile.getPath();
if (path.endsWith("bin/" + SquirrelConstants.SQUIRREL_COMPILER_NAME)) {
return StringUtil.trimEnd(path, "bin/" + SquirrelConstants.SQUIRREL_COMPILER_NAME);
}
} catch (IOException ignore) {
}
}
return null;
}
示例3: getExecuteFullPathSingle
import com.intellij.execution.configurations.PathEnvironmentVariableUtil; //导入依赖的package包/类
public static String getExecuteFullPathSingle(String exeName) {
List<File> fromPath = PathEnvironmentVariableUtil.findAllExeFilesInPath(exeName);
if (fromPath != null && fromPath.size() > 0) {
return fromPath.get(0).toString();
}
return null;
}
示例4: findAllStylintExe
import com.intellij.execution.configurations.PathEnvironmentVariableUtil; //导入依赖的package包/类
@NotNull
public static List<File> findAllStylintExe() {
Set<File> exes = ContainerUtil.newLinkedHashSet();
// TODO looks like on windows it only searches system path and not user's
List<File> fromPath = PathEnvironmentVariableUtil.findAllExeFilesInPath(NodeFinder.getBinName("stylint"));
exes.addAll(fromPath);
return ContainerUtil.newArrayList(exes);
}
示例5: searchNodeModulesBin
import com.intellij.execution.configurations.PathEnvironmentVariableUtil; //导入依赖的package包/类
@NotNull
public static List<File> searchNodeModulesBin(String exeFileName) {
Set<File> interpreters = ContainerUtil.newLinkedHashSet();
List<File> fromPath = PathEnvironmentVariableUtil.findAllExeFilesInPath(exeFileName);
List<File> nvmInterpreters = listNodeInterpretersFromNvm(exeFileName);
List<File> brewInterpreters = listNodeInterpretersFromHomeBrew(exeFileName);
interpreters.addAll(fromPath);
interpreters.removeAll(nvmInterpreters);
interpreters.removeAll(brewInterpreters);
interpreters.addAll(nvmInterpreters);
interpreters.addAll(brewInterpreters);
return ContainerUtil.newArrayList(interpreters);
}
示例6: execute
import com.intellij.execution.configurations.PathEnvironmentVariableUtil; //导入依赖的package包/类
@NotNull
public static OSProcessHandler execute(@NotNull String exePath,
@Nullable String workingDirectory,
@Nullable VirtualFile scriptFile,
String[] parameters,
@Nullable Charset charset) throws ExecutionException {
exePath = PathEnvironmentVariableUtil.findAbsolutePathOnMac(exePath);
return doExecute(exePath, workingDirectory, scriptFile, parameters, charset);
}
示例7: createCommandLine
import com.intellij.execution.configurations.PathEnvironmentVariableUtil; //导入依赖的package包/类
@Nullable
public GeneralCommandLine createCommandLine(DataContext dataContext) {
if (StringUtil.isEmpty(getWorkingDirectory())) {
setWorkingDirectory("$ProjectFileDir$");
}
GeneralCommandLine commandLine = new GeneralCommandLine();
try {
String paramString = MacroManager.getInstance().expandMacrosInString(getParameters(), true, dataContext);
String workingDir = MacroManager.getInstance().expandMacrosInString(getWorkingDirectory(), true, dataContext);
String exePath = MacroManager.getInstance().expandMacrosInString(getProgram(), true, dataContext);
commandLine.getParametersList().addParametersString(
MacroManager.getInstance().expandMacrosInString(paramString, false, dataContext));
final String workDirExpanded = MacroManager.getInstance().expandMacrosInString(workingDir, false, dataContext);
if (!StringUtil.isEmpty(workDirExpanded)) {
commandLine.setWorkDirectory(workDirExpanded);
}
exePath = MacroManager.getInstance().expandMacrosInString(exePath, false, dataContext);
if (exePath == null) return null;
File exeFile = new File(exePath);
if (exeFile.isDirectory() && exeFile.getName().endsWith(".app")) {
commandLine.setExePath("open");
commandLine.getParametersList().prependAll("-a", exePath);
}
else {
exePath = PathEnvironmentVariableUtil.toLocatableExePath(exePath);
commandLine.setExePath(exePath);
}
}
catch (Macro.ExecutionCancelledException ignored) {
return null;
}
return commandLine;
}
示例8: getCondaExecutable
import com.intellij.execution.configurations.PathEnvironmentVariableUtil; //导入依赖的package包/类
@Nullable
public static String getCondaExecutable() {
final String condaName = SystemInfo.isWindows ? "conda.exe" : "conda";
final File condaInPath = PathEnvironmentVariableUtil.findInPath(condaName);
if (condaInPath != null) return condaInPath.getPath();
return getCondaExecutable(condaName);
}
示例9: findExecutable
import com.intellij.execution.configurations.PathEnvironmentVariableUtil; //导入依赖的package包/类
@Nonnull
public static String findExecutable(@Nonnull String programName, @Nonnull String unixExec, @Nonnull String winExec, @Nonnull Collection<String> envs) {
String exec = findEnvValue(programName, envs);
if (exec != null) {
return exec;
}
File fileExec = PathEnvironmentVariableUtil.findInPath(SystemInfo.isWindows ? winExec : unixExec);
if (fileExec != null) {
return fileExec.getAbsolutePath();
}
throw new IllegalStateException(programName +
" executable not found. " +
(envs.size() > 0 ? "Please define a valid environment variable " + envs.iterator().next() + " pointing to the " + programName + " executable." : ""));
}
示例10: get
import com.intellij.execution.configurations.PathEnvironmentVariableUtil; //导入依赖的package包/类
@NotNull
public static SceneBuilderInfo get(Project project, boolean choosePathIfEmpty) {
JavaFxSettings settings = JavaFxSettings.getInstance();
String pathToSceneBuilder = settings.getPathToSceneBuilder();
if (StringUtil.isEmptyOrSpaces(pathToSceneBuilder) || !new File(pathToSceneBuilder).exists()) {
VirtualFile sceneBuilderFile = null;
if (choosePathIfEmpty) {
sceneBuilderFile = FileChooser.chooseFile(JavaFxSettingsConfigurable.createSceneBuilderDescriptor(), project, getPredefinedPath());
}
if (sceneBuilderFile == null) {
return EMPTY;
}
pathToSceneBuilder = FileUtil.toSystemIndependentName(sceneBuilderFile.getPath());
settings.setPathToSceneBuilder(pathToSceneBuilder);
}
File sceneBuilderLibsFile;
if (SystemInfo.isMac) {
sceneBuilderLibsFile = new File(new File(pathToSceneBuilder, "Contents"), "Java");
}
else if (SystemInfo.isWindows) {
File sceneBuilderRoot = new File(pathToSceneBuilder);
File sceneBuilderRootDir = sceneBuilderRoot.getParentFile();
if (sceneBuilderRootDir == null) {
final File foundInPath = PathEnvironmentVariableUtil.findInPath(pathToSceneBuilder);
if (foundInPath != null) {
sceneBuilderRootDir = foundInPath.getParentFile();
}
}
sceneBuilderRoot = sceneBuilderRootDir != null ? sceneBuilderRootDir.getParentFile() : null;
if (sceneBuilderRoot != null) {
final File appFile = new File(sceneBuilderRootDir, "app");
if (appFile.isDirectory()) {
sceneBuilderLibsFile = appFile;
}
else {
final File libFile = new File(sceneBuilderRoot, "lib");
sceneBuilderLibsFile = libFile.isDirectory() ? libFile : null;
}
}
else {
sceneBuilderLibsFile = null;
}
}
else {
sceneBuilderLibsFile = new File(new File(pathToSceneBuilder).getParent(), "app");
}
if (sceneBuilderLibsFile != null && (!sceneBuilderLibsFile.exists() || !sceneBuilderLibsFile.isDirectory())) {
sceneBuilderLibsFile = null;
}
return new SceneBuilderInfo(pathToSceneBuilder, sceneBuilderLibsFile == null ? null : sceneBuilderLibsFile.getAbsolutePath());
}
示例11: getMakeExecutable
import com.intellij.execution.configurations.PathEnvironmentVariableUtil; //导入依赖的package包/类
@Nullable
public static String getMakeExecutable() {
File make = PathEnvironmentVariableUtil.findInPath("make");
if (make == null) return null;
return make.getAbsolutePath();
}
示例12: findInPath
import com.intellij.execution.configurations.PathEnvironmentVariableUtil; //导入依赖的package包/类
public File findInPath(String fileName) {
return PathEnvironmentVariableUtil.findInPath(fileName);
}