本文整理汇总了Java中com.intellij.openapi.util.io.FileSystemUtil.resolveSymLink方法的典型用法代码示例。如果您正苦于以下问题:Java FileSystemUtil.resolveSymLink方法的具体用法?Java FileSystemUtil.resolveSymLink怎么用?Java FileSystemUtil.resolveSymLink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.util.io.FileSystemUtil
的用法示例。
在下文中一共展示了FileSystemUtil.resolveSymLink方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getExecutablePath
import com.intellij.openapi.util.io.FileSystemUtil; //导入方法依赖的package包/类
@Nullable
public static String getExecutablePath(@NotNull final String homeDirectory, @NotNull String name) {
File binPath = new File(homeDirectory);
File binDir = binPath.getParentFile();
if (binDir == null) return null;
File runner = new File(binDir, name);
if (runner.exists()) return LocalFileSystem.getInstance().extractPresentableUrl(runner.getPath());
runner = new File(new File(binDir, "Scripts"), name);
if (runner.exists()) return LocalFileSystem.getInstance().extractPresentableUrl(runner.getPath());
runner = new File(new File(binDir.getParentFile(), "Scripts"), name);
if (runner.exists()) return LocalFileSystem.getInstance().extractPresentableUrl(runner.getPath());
runner = new File(new File(binDir.getParentFile(), "local"), name);
if (runner.exists()) return LocalFileSystem.getInstance().extractPresentableUrl(runner.getPath());
runner = new File(new File(new File(binDir.getParentFile(), "local"), "bin"), name);
if (runner.exists()) return LocalFileSystem.getInstance().extractPresentableUrl(runner.getPath());
// if interpreter is a symlink
if (FileSystemUtil.isSymLink(homeDirectory)) {
String resolvedPath = FileSystemUtil.resolveSymLink(homeDirectory);
if (resolvedPath != null) {
return getExecutablePath(resolvedPath, name);
}
}
// Search in standard unix path
runner = new File(new File("/usr", "bin"), name);
if (runner.exists()) return LocalFileSystem.getInstance().extractPresentableUrl(runner.getPath());
runner = new File(new File(new File("/usr", "local"), "bin"), name);
if (runner.exists()) return LocalFileSystem.getInstance().extractPresentableUrl(runner.getPath());
return null;
}
示例2: collectPythonInstallations
import com.intellij.openapi.util.io.FileSystemUtil; //导入方法依赖的package包/类
private static void collectPythonInstallations(String pythonPath, Set<String> candidates) {
VirtualFile rootVDir = LocalFileSystem.getInstance().findFileByPath(pythonPath);
if (rootVDir != null) {
if (rootVDir instanceof NewVirtualFile) {
((NewVirtualFile)rootVDir).markDirty();
}
rootVDir.refresh(true, false);
for (VirtualFile dir : rootVDir.getChildren()) {
final String dirName = dir.getName().toLowerCase();
if (dir.isDirectory()) {
if ("Current".equals(dirName) || dirName.startsWith("2") || dirName.startsWith("3")) {
final VirtualFile binDir = dir.findChild("bin");
if (binDir != null && binDir.isDirectory()) {
for (String name : POSSIBLE_BINARY_NAMES) {
final VirtualFile child = binDir.findChild(name);
if (child == null) continue;
String path = child.getPath();
if (FileSystemUtil.isSymLink(path)) {
path = FileSystemUtil.resolveSymLink(path);
}
if (path != null && !candidates.contains(path)) {
candidates.add(path);
break;
}
}
}
}
}
}
}
}
示例3: collectUnixPythons
import com.intellij.openapi.util.io.FileSystemUtil; //导入方法依赖的package包/类
public static void collectUnixPythons(String path, Set<String> candidates) {
VirtualFile rootDir = LocalFileSystem.getInstance().findFileByPath(path);
if (rootDir != null) {
if (rootDir instanceof NewVirtualFile) {
((NewVirtualFile)rootDir).markDirty();
}
rootDir.refresh(true, false);
VirtualFile[] suspects = rootDir.getChildren();
for (VirtualFile child : suspects) {
if (!child.isDirectory()) {
final String childName = child.getName().toLowerCase();
for (String name : NAMES) {
if (childName.startsWith(name) || PYTHON_RE.matcher(childName).matches()) {
String childPath = child.getPath();
if (FileSystemUtil.isSymLink(childPath)) {
childPath = FileSystemUtil.resolveSymLink(childPath);
}
if (childPath != null && !childName.endsWith("-config") && !childName.startsWith("pythonw") && !childName.endsWith("m") &&
!candidates.contains(childPath)) {
candidates.add(childPath);
}
break;
}
}
}
}
}
}
示例4: getDeploymentName
import com.intellij.openapi.util.io.FileSystemUtil; //导入方法依赖的package包/类
@NotNull
@Override
protected String getDeploymentName(DeploymentModel deployment, File source) throws Exception {
String path = source.getAbsolutePath();
String deploymentName = source.isDirectory() || path.endsWith(".jar") ? path : FileUtil.getNameWithoutExtension(path);
if (FileSystemUtil.isSymLink(deploymentName)) {
String resolvedPath = FileSystemUtil.resolveSymLink(deploymentName);
if (resolvedPath != null) {
return resolvedPath;
}
}
return deploymentName;
}
示例5: resolveSymLink
import com.intellij.openapi.util.io.FileSystemUtil; //导入方法依赖的package包/类
@Override
public String resolveSymLink(@NotNull VirtualFile file) {
return FileSystemUtil.resolveSymLink(file.getPath());
}
示例6: resolveSymLink
import com.intellij.openapi.util.io.FileSystemUtil; //导入方法依赖的package包/类
@Override
public String resolveSymLink(@Nonnull VirtualFile file) {
return FileSystemUtil.resolveSymLink(file.getPath());
}