當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。