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


Java FileUtil.toSystemIndependentName方法代码示例

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


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

示例1: getTemplateRootFolder

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
/**
 * @return the root folder containing templates
 */
@Nullable
public static File getTemplateRootFolder() {
  String homePath = FileUtil.toSystemIndependentName(PathManager.getHomePath());
  // Release build?
  VirtualFile root = LocalFileSystem.getInstance().findFileByPath(FileUtil.toSystemIndependentName(homePath + BUNDLED_TEMPLATE_PATH));
  if (root == null) {
    // Development build?
    for (String path : DEVELOPMENT_TEMPLATE_PATHS) {
      root = LocalFileSystem.getInstance().findFileByPath(FileUtil.toSystemIndependentName(homePath + path));

      if (root != null) {
        break;
      }
    }
  }
  if (root != null) {
    File rootFile = VfsUtilCore.virtualToIoFile(root);
    if (templateRootIsValid(rootFile)) {
      return rootFile;
    }
  }

  // Fall back to SDK template root
  AndroidSdkData sdkData = AndroidSdkUtils.tryToChooseAndroidSdk();
  if (sdkData != null) {
    File location = sdkData.getLocation();
    File folder = new File(location, FD_TOOLS + File.separator + FD_TEMPLATES);
    if (folder.isDirectory()) {
      return folder;
    }
  }

  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:38,代码来源:TemplateManager.java

示例2: getText

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
@Nullable
public String getText() {
  final AntDomFileReferenceSet refSet = getFileReferenceSet();
  final String _path = AntStringResolver.computeString(refSet.getAttributeValue(), super.getText());
  final String text = FileUtil.toSystemIndependentName(_path);
  return text.endsWith("/")? text.substring(0, text.length() - "/".length()) : text;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:AntDomFileReference.java

示例3: getConfiguredOutputPath

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
@Nullable
private String getConfiguredOutputPath() {
  String outputPath = FileUtil.toSystemIndependentName(myOutputDirectoryField.getText().trim());
  if (outputPath.length() == 0) {
    outputPath = null;
  }
  return outputPath;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:ArtifactEditorImpl.java

示例4: addFileOrDirRecursively

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
private void addFileOrDirRecursively(@NotNull ZipOutputStream jarOutputStream,
                                     @NotNull File file,
                                     SourceFileFilter filter,
                                     @NotNull String relativePath,
                                     String targetJarPath,
                                     @NotNull Set<String> writtenItemRelativePaths,
                                     List<String> packedFilePaths,
                                     int rootIndex) throws IOException {
  final String filePath = FileUtil.toSystemIndependentName(file.getAbsolutePath());
  if (!filter.accept(filePath) || !filter.shouldBeCopied(filePath, myContext.getProjectDescriptor())) {
    return;
  }

  if (file.isDirectory()) {
    final String directoryPath = relativePath.length() == 0 ? "" : relativePath + "/";
    if (!directoryPath.isEmpty()) {
      addDirectoryEntry(jarOutputStream, directoryPath, writtenItemRelativePaths);
    }
    final File[] children = file.listFiles();
    if (children != null) {
      for (File child : children) {
        addFileOrDirRecursively(jarOutputStream, child, filter, directoryPath + child.getName(), targetJarPath, writtenItemRelativePaths,
                                packedFilePaths, rootIndex);
      }
    }
    return;
  }

  final boolean added = ZipUtil.addFileToZip(jarOutputStream, file, relativePath, writtenItemRelativePaths, null);
  if (rootIndex != -1) {
    myOutSrcMapping.appendData(targetJarPath, rootIndex, filePath);
    if (added) {
      packedFilePaths.add(filePath);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:37,代码来源:JarsBuilder.java

示例5: calcConfigPath

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
@Nullable
private static String calcConfigPath(@NotNull String path) {
  try {
    final String _path = FileUtil.toSystemIndependentName(new File(path).getCanonicalPath());
    return _path.endsWith("/") ? _path : _path + "/";
  }
  catch (IOException e) {
    LOG.info(e);
    return null;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:FileBasedIndexImpl.java

示例6: preparePathsForComparison

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
private static String preparePathsForComparison(String fileContent, Module mod1, Module mod2) {
  fileContent = FileUtil.toSystemIndependentName(fileContent);
  fileContent = replace(fileContent, ModuleRootManager.getInstance(mod1).getContentRoots()[0].getPath(), "MODULE_1");
  fileContent = replace(fileContent, ModuleRootManager.getInstance(mod2).getContentRoots()[0].getPath(), "MODULE_2");
  fileContent = replace(fileContent, PathUtil.getJarPathForClass(ServiceMessageTypes.class), "SERVICE_MESSAGES");
  fileContent = fileContent.replaceAll(FileUtil.toSystemIndependentName(PathUtil.getJarPathForClass(JUnitStarter.class)) + File.pathSeparator, "");
  fileContent = fileContent.replaceAll(FileUtil.toSystemIndependentName(JavaSdkUtil.getIdeaRtJarPath()) + File.pathSeparator, "");
  fileContent = replace(fileContent, PathManager.getHomePath() + "/community", "IDEA_HOME");
  fileContent = replace(fileContent, PathManager.getHomePath(), "IDEA_HOME");
  fileContent = fileContent.replaceAll(File.pathSeparator, ";");
  return StringUtil.convertLineSeparators(fileContent);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:JUnitClasspathTest.java

示例7: resolve

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
public PsiElement resolve() {
  VirtualFile baseDir = myPsiFile.getVirtualFile().getParent();
  String relPath = FileUtil.toSystemIndependentName(myText + "/" + MavenConstants.POM_XML);
  VirtualFile file = baseDir.findFileByRelativePath(relPath);

  if (file == null) return null;

  return getPsiFile(file);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:MavenModulePsiReference.java

示例8: getTestDataFolder

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
public static String getTestDataFolder() {
  final File f = new File("src/test/resources");
  return FileUtil.toSystemIndependentName(f.getAbsolutePath());
}
 
开发者ID:google,项目名称:bamboo-soy,代码行数:5,代码来源:SoyTestUtils.java

示例9: getScriptName

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

示例10: getRepositoryPath

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
protected String getRepositoryPath() {
  String path = getRepositoryFile().getPath();
  return FileUtil.toSystemIndependentName(path);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:MavenTestCase.java

示例11: setupRootModel

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
private static void setupRootModel(
        ProjectDescriptor projectDescriptor,
        final ModuleDescriptor descriptor,
        final ModifiableRootModel rootModel,
        final Map<LibraryDescriptor, Library> projectLibs) {
    final CompilerModuleExtension compilerModuleExtension =
            rootModel.getModuleExtension(CompilerModuleExtension.class);
    compilerModuleExtension.setExcludeOutput(true);
    rootModel.inheritSdk();

    //Module root model seems to store .iml files root dependencies. (src, test, lib)
    logger.info("Starting setupRootModel in ProjectFromSourcesBuilderImplModified");
    final Set<File> contentRoots = descriptor.getContentRoots();
    for (File contentRoot : contentRoots) {
        final LocalFileSystem lfs = LocalFileSystem.getInstance();
        VirtualFile moduleContentRoot =
                lfs.refreshAndFindFileByPath(
                        FileUtil.toSystemIndependentName(contentRoot.getPath()));
        if (moduleContentRoot != null) {
            final ContentEntry contentEntry = rootModel.addContentEntry(moduleContentRoot);
            final Collection<DetectedSourceRoot> sourceRoots =
                    descriptor.getSourceRoots(contentRoot);
            for (DetectedSourceRoot srcRoot : sourceRoots) {
                final String srcpath =
                        FileUtil.toSystemIndependentName(srcRoot.getDirectory().getPath());
                final VirtualFile sourceRoot = lfs.refreshAndFindFileByPath(srcpath);
                if (sourceRoot != null) {
                    contentEntry.addSourceFolder(
                            sourceRoot,
                            shouldBeTestRoot(srcRoot.getDirectory()),
                            getPackagePrefix(srcRoot));
                }
            }
        }
    }
    logger.info("Inherits compiler output path from project");
    compilerModuleExtension.inheritCompilerOutputPath(true);

    logger.info("Starting to create module level libraries");
    final LibraryTable moduleLibraryTable = rootModel.getModuleLibraryTable();
    for (LibraryDescriptor libDescriptor :
            ModuleInsight.getLibraryDependencies(
                    descriptor, projectDescriptor.getLibraries())) {
        final Library projectLib = projectLibs.get(libDescriptor);
        if (projectLib != null) {
            rootModel.addLibraryEntry(projectLib);
        } else {
            // add as module library
            final Collection<File> jars = libDescriptor.getJars();
            for (File file : jars) {
                Library library = moduleLibraryTable.createLibrary();
                Library.ModifiableModel modifiableModel = library.getModifiableModel();
                modifiableModel.addRoot(
                        VfsUtil.getUrlForLibraryRoot(file), OrderRootType.CLASSES);
                modifiableModel.commit();
            }
        }
    }
    logger.info("Ending setupRootModel in ProjectFromSourcesBuilderImplModified");
}
 
开发者ID:testmycode,项目名称:tmc-intellij,代码行数:61,代码来源:ProjectFromSourcesBuilderImplModified.java

示例12: doEvaluate

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
private String doEvaluate(final String text, final String file) {
  final PyExpression expression = PyElementGenerator.getInstance(myFixture.getProject()).createExpressionFromText(text);
  return FileUtil.toSystemIndependentName((String) new PyPathEvaluator(file).evaluate(expression));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:PyPathEvaluatorTest.java

示例13: getRootPath

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

示例14: getPath

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
public String getPath() {
  return FileUtil.toSystemIndependentName(myPathField.getChildComponent().getText().trim());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:AlternativeJREPanel.java

示例15: getArtifactBaseOutputPath

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
private static String getArtifactBaseOutputPath(Project project) {
  String outputUrl = project.getBaseDir().getUrl() + "/out/artifacts";
  return FileUtil.toSystemIndependentName(VfsUtilCore.urlToPath(outputUrl));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:GradleCompilingTestCase.java


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