当前位置: 首页>>代码示例>>Java>>正文


Java FileUtilRt.toSystemIndependentName方法代码示例

本文整理汇总了Java中com.intellij.openapi.util.io.FileUtilRt.toSystemIndependentName方法的典型用法代码示例。如果您正苦于以下问题:Java FileUtilRt.toSystemIndependentName方法的具体用法?Java FileUtilRt.toSystemIndependentName怎么用?Java FileUtilRt.toSystemIndependentName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.openapi.util.io.FileUtilRt的用法示例。


在下文中一共展示了FileUtilRt.toSystemIndependentName方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: toURI

import com.intellij.openapi.util.io.FileUtilRt; //导入方法依赖的package包/类
public static URI toURI(String localPath) {
  try {
    String p = FileUtilRt.toSystemIndependentName(localPath);
    if (!p.startsWith("/")) {
      p = "/" + p;
    }
    if (!p.startsWith("//")) {
      p = "//" + p;
    }
    return new URI("file", null, p, null);
  }
  catch (URISyntaxException e) {
    throw new Error(e);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:Utils.java

示例2: convertToRegexp

import com.intellij.openapi.util.io.FileUtilRt; //导入方法依赖的package包/类
private static CompiledPattern convertToRegexp(String wildcardPattern) {
  if (isPatternNegated(wildcardPattern)) {
    wildcardPattern = wildcardPattern.substring(1);
  }

  wildcardPattern = FileUtilRt.toSystemIndependentName(wildcardPattern);

  String srcRoot = null;
  int colon = wildcardPattern.indexOf(":");
  if (colon > 0) {
    srcRoot = wildcardPattern.substring(0, colon);
    wildcardPattern = wildcardPattern.substring(colon + 1);
  }
  
  String dirPattern = null;
  int slash = wildcardPattern.lastIndexOf('/');
  if (slash >= 0) {
    dirPattern = wildcardPattern.substring(0, slash + 1);
    wildcardPattern = wildcardPattern.substring(slash + 1);
    if (!dirPattern.startsWith("/")) {
      dirPattern = "/" + dirPattern;
    }
    //now dirPattern starts and ends with '/'

    dirPattern = normalizeWildcards(dirPattern);

    dirPattern = StringUtil.replace(dirPattern, "/.*.*/", "(/.*)?/");
    dirPattern = StringUtil.trimEnd(dirPattern, "/");

    dirPattern = optimize(dirPattern);
  }

  wildcardPattern = normalizeWildcards(wildcardPattern);
  wildcardPattern = optimize(wildcardPattern);

  final Pattern dirCompiled = dirPattern == null ? null : compilePattern(dirPattern);
  final Pattern srcCompiled = srcRoot == null ? null : compilePattern(optimize(normalizeWildcards(srcRoot)));
  return new CompiledPattern(compilePattern(wildcardPattern), dirCompiled, srcCompiled);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:40,代码来源:ResourcePatterns.java

示例3: getLibraryRootUrl

import com.intellij.openapi.util.io.FileUtilRt; //导入方法依赖的package包/类
public static String getLibraryRootUrl(File file) {
  String path = FileUtilRt.toSystemIndependentName(file.getAbsolutePath());
  if (file.isDirectory()) {
    return "file://" + path;
  }
  return "jar://" + path + "!/";
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:JpsPathUtil.java

示例4: loadProjectByAbsolutePath

import com.intellij.openapi.util.io.FileUtilRt; //导入方法依赖的package包/类
protected void loadProjectByAbsolutePath(String path) {
  myProjectHomePath = FileUtilRt.toSystemIndependentName(path);
  if (myProjectHomePath.endsWith(".ipr")) {
    myProjectHomePath = PathUtil.getParentPath(myProjectHomePath);
  }
  try {
    JpsProjectLoader.loadProject(myProject, getPathVariables(), path);
  }
  catch (IOException e) {
    throw new RuntimeException(e);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:JpsSerializationTestCase.java

示例5: createProject

import com.intellij.openapi.util.io.FileUtilRt; //导入方法依赖的package包/类
private ProjectImpl createProject(@Nullable String projectName, @NotNull String filePath, boolean isDefault) {
  if (isDefault) {
    return new DefaultProject(this, "");
  }
  else {
    return new ProjectImpl(this, FileUtilRt.toSystemIndependentName(filePath), projectName);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:ProjectManagerImpl.java

示例6: compare

import com.intellij.openapi.util.io.FileUtilRt; //导入方法依赖的package包/类
@Override
public int compare(@NotNull FilePath filePath1, @NotNull FilePath filePath2) {
  final String path1 = FileUtilRt.toSystemIndependentName(filePath1.getPath());
  final String path2 = FileUtilRt.toSystemIndependentName(filePath2.getPath());

  int index1 = 0;
  int index2 = 0;

  int start = 0;

  while (index1 < path1.length() && index2 < path2.length()) {
    char c1 = path1.charAt(index1);
    char c2 = path2.charAt(index2);

    if (StringUtil.compare(c1, c2, myIgnoreCase) != 0) break;

    if (c1 == '/') start = index1;

    index1++;
    index2++;
  }

  if (index1 == path1.length() && index2 == path2.length()) return 0;
  if (index1 == path1.length()) return -1;
  if (index2 == path2.length()) return 1;

  int end1 = path1.indexOf('/', start + 1);
  int end2 = path2.indexOf('/', start + 1);

  String name1 = end1 == -1 ? path1.substring(start) : path1.substring(start, end1);
  String name2 = end2 == -1 ? path2.substring(start) : path2.substring(start, end2);

  boolean isDirectory1 = end1 != -1 || filePath1.isDirectory();
  boolean isDirectory2 = end2 != -1 || filePath2.isDirectory();

  if (isDirectory1 && !isDirectory2) return -1;
  if (!isDirectory1 && isDirectory2) return 1;

  return StringUtil.compare(name1, name2, myIgnoreCase);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:41,代码来源:HierarchicalFilePathComparator.java

示例7: getRootId

import com.intellij.openapi.util.io.FileUtilRt; //导入方法依赖的package包/类
@Override
public String getRootId() {
  return FileUtilRt.toSystemIndependentName(myRoot.getAbsolutePath());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:BuildRootDescriptorImpl.java

示例8: toSystemIndependentName

import com.intellij.openapi.util.io.FileUtilRt; //导入方法依赖的package包/类
@Contract("null -> null; !null -> !null")
public static String toSystemIndependentName(@Nullable String path) {
  return path == null ? null : FileUtilRt.toSystemIndependentName(path);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:PathUtil.java

示例9: newLocalFileUrl

import com.intellij.openapi.util.io.FileUtilRt; //导入方法依赖的package包/类
@NotNull
public static Url newLocalFileUrl(@NotNull String path) {
  return new LocalFileUrl(FileUtilRt.toSystemIndependentName(path));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:Urls.java


注:本文中的com.intellij.openapi.util.io.FileUtilRt.toSystemIndependentName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。