本文整理了Java中com.intellij.openapi.util.io.FileUtil.toSystemIndependentName()
方法的一些代码示例,展示了FileUtil.toSystemIndependentName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtil.toSystemIndependentName()
方法的具体详情如下:
包路径:com.intellij.openapi.util.io.FileUtil
类名称:FileUtil
方法名:toSystemIndependentName
暂无
代码示例来源:origin: go-lang-plugin-org/go-lang-idea-plugin
@Nullable
public static VirtualFile findByImportPath(@NotNull String importPath, @NotNull Project project, @Nullable Module module) {
if (importPath.isEmpty()) {
return null;
}
importPath = FileUtil.toSystemIndependentName(importPath);
for (VirtualFile root : GoSdkUtil.getSourcesPathsToLookup(project, module)) {
VirtualFile file = root.findFileByRelativePath(importPath);
if (file != null) {
return file;
}
}
return null;
}
}
代码示例来源:origin: ballerina-platform/ballerina-lang
@Nullable
public static VirtualFile findByPath(@NotNull String path, @NotNull Project project) {
String systemIndependentPath = FileUtil.toSystemIndependentName(path);
VirtualFile projectBaseDir = project.getBaseDir();
if (systemIndependentPath.isEmpty()) {
return projectBaseDir;
}
return projectBaseDir.findFileByRelativePath(systemIndependentPath);
}
}
代码示例来源:origin: KronicDeth/intellij-elixir
public String getAbsolutePath(String pathRelativeToProjectRoot){
return FileUtil.toSystemIndependentName(new File(getOrCreateProjectDir(), pathRelativeToProjectRoot).getAbsolutePath());
}
代码示例来源:origin: KronicDeth/intellij-elixir
public String createFile(String relativePath, String text){
try{
File file = new File(getOrCreateProjectDir(), relativePath);
FileUtil.writeToFile(file, text);
return FileUtil.toSystemIndependentName(file.getAbsolutePath());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: KronicDeth/intellij-elixir
private JpsSdk<JpsDummyElement> addJdk(@SuppressWarnings("SameParameterValue") String name) {
try{
return addJdk(name, FileUtil.toSystemIndependentName(ClasspathBootstrap.getResourceFile(Object.class).getCanonicalPath()));
} catch (IOException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: KronicDeth/intellij-elixir
protected static void assertOutput(String outputPath, TestFileSystemBuilder expected){
expected.build().assertDirectoryEqual(new File(FileUtil.toSystemIndependentName(outputPath)));
}
代码示例来源:origin: KronicDeth/intellij-elixir
private static void assertRelativePaths(File[] baseDirs, Collection<File> files, String[] expected){
List<String> relativePaths = new ArrayList<String>();
for (File file: files){
String path = file.getAbsolutePath();
for(File baseDir:baseDirs){
if(baseDir != null && FileUtil.isAncestor(baseDir, file, false)){
path = FileUtil.getRelativePath(baseDir, file);
break;
}
}
relativePaths.add(FileUtil.toSystemIndependentName(path));
}
UsefulTestCase.assertSameElements(relativePaths, expected);
}
}
代码示例来源:origin: dboissier/mongo4idea
public VirtualFile getScriptPath() {
if (scriptPath == null) return null;
return LocalFileSystem.getInstance().findFileByPath(FileUtil.toSystemIndependentName(scriptPath));
}
代码示例来源:origin: Camelcade/Perl5-IDEA
/**
* Linuxies path if local system is windows. Changing {@code c:\some\path} to {@code /c/some/path}
*/
@NotNull
public static String linuxisePath(@NotNull String localPath) {
if (!SystemInfo.isWindows || localPath.isEmpty()) {
return localPath;
}
char driveLetter = localPath.charAt(0);
return "/" + driveLetter + "/" +
(localPath.length() > 3 ? FileUtil.toSystemIndependentName(localPath.substring(3)) : "");
}
代码示例来源:origin: Camelcade/Perl5-IDEA
/**
* @return path to a helper with {@code relativePath}
*/
public static String getHelperPath(@NotNull String relativePath) {
return FileUtil.toSystemIndependentName(new File(getPluginHelpersRoot(), relativePath).getPath());
}
代码示例来源:origin: Camelcade/Perl5-IDEA
@Nullable
public PerlFileDescriptor getParentDescriptor() {
if (this == ROOT_DESCRIPTOR) {
return null;
}
if (myPath.equals("/")) {
return ROOT_DESCRIPTOR;
}
File parentFile = new File(myPath);
return new PerlFileDescriptor(FileUtil.toSystemIndependentName(parentFile.getParent()), parentFile.getName(), Type.DIRECTORY, 0);
}
代码示例来源:origin: Camelcade/Perl5-IDEA
/**
* @return path to IDE perl helper scripts
*/
@NotNull
public static String getPluginHelpersRoot() {
return FileUtil.toSystemIndependentName(new File(getPluginRoot(), "perl").getPath());
}
代码示例来源:origin: Camelcade/Perl5-IDEA
@Nullable
@Override
protected String doGetRemotePath(@NotNull String localPath) {
return FileUtil.toSystemIndependentName(new File(CONTAINER_ROOT_FILE, PerlFileUtil.linuxisePath(localPath)).getPath());
}
代码示例来源:origin: Camelcade/Perl5-IDEA
@NotNull
public static String getPluginRoot() {
IdeaPluginDescriptor plugin = PerlPluginUtil.getPlugin();
try {
return FileUtil.toSystemIndependentName(plugin.getPath().getCanonicalPath());
}
catch (IOException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: Camelcade/Perl5-IDEA
@Override
public String mapPathToRemote(@NotNull String localPathName) {
File localPath = new File(localPathName);
if (FileUtil.isAncestor(myLocalProjectPath, localPath, false)) {
return FileUtil.toSystemIndependentName(
new File(myRemoteProjectPath, Objects.requireNonNull(FileUtil.getRelativePath(myLocalProjectPath, localPath))).getPath()
);
}
else {
return localPathName;
}
}
代码示例来源:origin: Camelcade/Perl5-IDEA
/**
* Downloads {@code remoteFile} to the local cache
*/
@Contract("null->null; !null->!null")
@Nullable
public final File syncFile(@Nullable File remoteFile) {
if (remoteFile == null) {
return null;
}
return new File(syncFile(FileUtil.toSystemIndependentName(remoteFile.getPath())));
}
代码示例来源:origin: Camelcade/Perl5-IDEA
@Override
public VirtualFile getParent() {
if (myDescriptor == PerlFileDescriptor.ROOT_DESCRIPTOR) {
return null;
}
return myFiles.computeIfAbsent(
FileUtil.toSystemIndependentName(new File(getPath()).getParent()),
it -> new PerlDockerVirtualFile(Objects.requireNonNull(myDescriptor.getParentDescriptor())));
}
代码示例来源:origin: Camelcade/Perl5-IDEA
@Nullable
@Override
protected String doGetLocalPath(@NotNull String remotePath) {
File remoteFile = new File(remotePath);
if (FileUtil.isAncestor(CONTAINER_ROOT_FILE, remoteFile, false)) {
return PerlFileUtil.unLinuxisePath('/' + FileUtil.getRelativePath(CONTAINER_ROOT_FILE, remoteFile));
}
return FileUtil.toSystemIndependentName(FileUtil.join(getLocalCacheRoot(), remotePath));
}
代码示例来源:origin: sonar-intellij-plugin/sonar-intellij-plugin
public VirtualFile compute() {
final String path = FileUtil.toSystemIndependentName(mySourcePathTextFieldWithBrowseButton.getText());
return LocalFileSystem.getInstance().refreshAndFindFileByPath(path);
}
}
代码示例来源:origin: sonar-intellij-plugin/sonar-intellij-plugin
public VirtualFile compute() {
final String path = FileUtil.toSystemIndependentName(myPathToSonarReportTextFieldWithBrowseButton.getText
());
return !StringUtil.isEmptyOrSpaces(path)
? LocalFileSystem.getInstance().refreshAndFindFileByPath(path)
: null;
}
}
内容来源于网络,如有侵权,请联系作者删除!