當前位置: 首頁>>代碼示例>>Java>>正文


Java FileUtil.isAbsolute方法代碼示例

本文整理匯總了Java中com.intellij.openapi.util.io.FileUtil.isAbsolute方法的典型用法代碼示例。如果您正苦於以下問題:Java FileUtil.isAbsolute方法的具體用法?Java FileUtil.isAbsolute怎麽用?Java FileUtil.isAbsolute使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.openapi.util.io.FileUtil的用法示例。


在下文中一共展示了FileUtil.isAbsolute方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getOutputFile

import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
@NotNull
private static File getOutputFile(
  final @NotNull ExportTestResultsConfiguration config,
  final @NotNull Project project,
  final @NotNull String filename)
{
  final File outputFolder;
  final String outputFolderPath = config.getOutputFolder();
  if (!StringUtil.isEmptyOrSpaces(outputFolderPath)) {
    if (FileUtil.isAbsolute(outputFolderPath)) {
      outputFolder = new File(outputFolderPath);
    }
    else {
      outputFolder = new File(new File(project.getBasePath()), config.getOutputFolder());
    }
  }
  else {
    outputFolder = new File(project.getBasePath());
  }

  return new File(outputFolder, filename);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:23,代碼來源:ExportTestResultsAction.java

示例2: getWorkingDir

import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
@Nullable
public String getWorkingDir(CommonProgramRunConfigurationParameters configuration, Project project, Module module) {
  String workingDirectory = configuration.getWorkingDirectory();
  String defaultWorkingDir = getDefaultWorkingDir(project);
  if (StringUtil.isEmptyOrSpaces(workingDirectory)) {
    workingDirectory = defaultWorkingDir;
    if (workingDirectory == null) {
      return null;
    }
  }
  workingDirectory = expandPath(workingDirectory, module, project);
  if (!FileUtil.isAbsolute(workingDirectory) && defaultWorkingDir != null) {
    if (("$" + PathMacroUtil.MODULE_DIR_MACRO_NAME + "$").equals(workingDirectory)) {
      return defaultWorkingDir;
    }
    workingDirectory = defaultWorkingDir + "/" + workingDirectory;
  }
  return workingDirectory;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:20,代碼來源:ProgramParametersConfigurator.java

示例3: getRelative

import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
public static String getRelative(String baseRoot, String path) {
  baseRoot = normalize(baseRoot);
  path = normalize(path);

  int prefix = findCommonPathPrefixLength(baseRoot, path);

  if (prefix != 0) {
    baseRoot = baseRoot.substring(prefix);
    path = path.substring(prefix);
    if (baseRoot.length() != 0) {
      return normalize(revertRelativePath(baseRoot.substring(1)) + path);
    }
    else if (path.length() != 0) {
      return path.substring(1);
    }
    else {
      return ".";
    }
  }
  else if (FileUtil.isAbsolute(path)) {
    return path;
  }
  else {
    return normalize(revertRelativePath(baseRoot) + "/" + path);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:27,代碼來源:PathUtil.java

示例4: staticFrom

import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
private static StaticFilePath staticFrom(final FilePath fp) {
  final String path = fp.getPath();
  if (fp.isNonLocal() && (! FileUtil.isAbsolute(path) || VcsUtil.isPathRemote(path))) {
    return new StaticFilePath(fp.isDirectory(), fp.getIOFile().getPath().replace('\\', '/'), fp.getVirtualFile());
  }
  return new StaticFilePath(fp.isDirectory(), new File(fp.getIOFile().getPath().replace('\\', '/')).getAbsolutePath(), fp.getVirtualFile());
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:8,代碼來源:TreeModelBuilder.java

示例5: isAbsolutePathReference

import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
@Override
public boolean isAbsolutePathReference() {
  if (!ApplicationManager.getApplication().isUnitTestMode()) {
    return FileUtil.isAbsolute(getPathString());
  }
  else {
    return super.isAbsolutePathReference();
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:10,代碼來源:RootFileReferenceSet.java

示例6: getTestFile

import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
private VirtualFile getTestFile(String name) {
  String path = FileUtil.isAbsolute(name) ? name : myFixture.getTestDataPath() + "/" + name;
  VirtualFileSystem fs = path.contains(URLUtil.JAR_SEPARATOR) ? StandardFileSystems.jar() : StandardFileSystems.local();
  VirtualFile file = fs.refreshAndFindFileByPath(path);
  assertNotNull(path, file);
  return file;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:8,代碼來源:IdeaDecompilerTest.java

示例7: getResourcesPluginGoalOutputDirectory

import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
@Nullable
private static String getResourcesPluginGoalOutputDirectory(@NotNull MavenProject mavenProject,
                                                            @Nullable Element pluginConfiguration,
                                                            @NotNull String goal) {
  final Element goalConfiguration = mavenProject.getPluginGoalConfiguration("org.apache.maven.plugins", "maven-resources-plugin", goal);
  String outputDirectory = MavenJDOMUtil.findChildValueByPath(goalConfiguration, "outputDirectory", null);
  if (outputDirectory == null) {
    outputDirectory = MavenJDOMUtil.findChildValueByPath(pluginConfiguration, "outputDirectory", null);
  }
  return outputDirectory == null || FileUtil.isAbsolute(outputDirectory)
         ? outputDirectory
         : mavenProject.getDirectory() + '/' + outputDirectory;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:14,代碼來源:MavenResourceCompilerConfigurationGenerator.java

示例8: makePath

import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
protected String makePath(MavenProject p, String... elements) {
  StringBuilder tailBuff = new StringBuilder();
  for (String e : elements) {
    if (tailBuff.length() > 0) tailBuff.append("/");
    tailBuff.append(e);
  }
  String tail = tailBuff.toString();
  String result = FileUtil.isAbsolute(tail) ? tail : new File(p.getDirectory(), tail).getPath();

  return FileUtil.toSystemIndependentName(PathUtil.getCanonicalPath(result));
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:12,代碼來源:FacetImporter.java

示例9: isAbsolutePathReference

import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
@Override
public boolean isAbsolutePathReference() {
  if (super.isAbsolutePathReference()) {
    return true;
  }

  String path = getPathString();
  return path != null && FileUtil.isAbsolute(path);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:10,代碼來源:AntDomFileReferenceSet.java

示例10: findGitDir

import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
@Nullable
public static VirtualFile findGitDir(@NotNull VirtualFile rootDir) {
  VirtualFile child = rootDir.findChild(DOT_GIT);
  if (child == null) {
    return null;
  }
  if (child.isDirectory()) {
    return child;
  }

  // this is standard for submodules, although probably it can
  String content;
  try {
    content = readFile(child);
  }
  catch (IOException e) {
    throw new RuntimeException("Couldn't read " + child, e);
  }
  String pathToDir;
  String prefix = "gitdir:";
  if (content.startsWith(prefix)) {
    pathToDir = content.substring(prefix.length()).trim();
  }
  else {
    pathToDir = content;
  }

  if (!FileUtil.isAbsolute(pathToDir)) {
    String canonicalPath = FileUtil.toCanonicalPath(FileUtil.join(rootDir.getPath(), pathToDir));
    if (canonicalPath == null) {
      return null;
    }
    pathToDir = FileUtil.toSystemIndependentName(canonicalPath);
  }
  return VcsUtil.getVirtualFileWithRefresh(new File(pathToDir));
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:37,代碼來源:GitUtil.java

示例11: makePathRelativeToTestFixture

import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
/**
 * Absolute file paths are prohibited -- the TempDirTestFixture used in these tests will prepend
 * it's own root to the path.
 */
private String makePathRelativeToTestFixture(String filePath) {
  if (!FileUtil.isAbsolute(filePath)) {
    return filePath;
  }
  String tempDirPath = getRootDir();
  assertThat(FileUtil.isAncestor(tempDirPath, filePath, true)).isTrue();
  return FileUtil.getRelativePath(tempDirPath, filePath, File.separatorChar);
}
 
開發者ID:bazelbuild,項目名稱:intellij,代碼行數:13,代碼來源:TestFileSystem.java

示例12: toPath

import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
public Path toPath(String path) {
  if (!FileUtil.isAbsolute(path)) {
    path = new File(myMavenProject.getDirectory(), path).getPath();
  }
  return new Path(path);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:7,代碼來源:MavenRootModelAdapter.java


注:本文中的com.intellij.openapi.util.io.FileUtil.isAbsolute方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。