本文整理汇总了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);
}
示例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;
}
示例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);
}
}
示例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());
}
示例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();
}
}
示例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;
}
示例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));
}
示例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);
}
示例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));
}
示例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);
}
示例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);
}