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


Java FileUtil.join方法代码示例

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


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

示例1: getAllAnswerTaskFiles

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
private static List<VirtualFile> getAllAnswerTaskFiles(@NotNull Course course, @NotNull Project project) {
  List<VirtualFile> result = new ArrayList<>();
  for (Lesson lesson : course.getLessons()) {
    for (Task task : lesson.getTaskList()) {
      for (Map.Entry<String, TaskFile> entry : task.getTaskFiles().entrySet()) {
        String name = entry.getKey();
        String answerName = FileUtil.getNameWithoutExtension(name) + CCUtils.ANSWER_EXTENSION_DOTTED + FileUtilRt.getExtension(name);
        String taskPath = FileUtil.join(project.getBasePath(), EduNames.LESSON + lesson.getIndex(), EduNames.TASK + task.getIndex());
        VirtualFile taskFile = LocalFileSystem.getInstance().findFileByPath(FileUtil.join(taskPath, answerName));
        if (taskFile == null) {
          taskFile = LocalFileSystem.getInstance().findFileByPath(FileUtil.join(taskPath, EduNames.SRC, answerName));
        }
        if (taskFile != null) {
          result.add(taskFile);
        }
      }
    }
  }
  return result;
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:21,代码来源:CCProjectComponent.java

示例2: getPatternDocument

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
@Nullable
public static Document getPatternDocument(@NotNull final TaskFile taskFile, String name) {
  Task task = taskFile.getTask();
  String lessonDir = EduNames.LESSON + String.valueOf(task.getLesson().getIndex());
  String taskDir = EduNames.TASK + String.valueOf(task.getIndex());
  Course course = task.getLesson().getCourse();
  File resourceFile = new File(course.getCourseDirectory());
  if (!resourceFile.exists()) {
    return  null;
  }
  String patternPath = FileUtil.join(resourceFile.getPath(), lessonDir, taskDir, name);
  VirtualFile patternFile = VfsUtil.findFileByIoFile(new File(patternPath), true);
  if (patternFile == null) {
    return null;
  }
  return FileDocumentManager.getInstance().getDocument(patternFile);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:StudyUtils.java

示例3: getDefaultSdkLocation

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
/**
 * @return Default Android SDK install location
 */
@NotNull
private static File getDefaultSdkLocation() {
  String userHome = System.getProperty("user.home");
  String path;
  if (SystemInfo.isWindows) {
    path = FileUtil.join(userHome, "AppData", "Local", "Android", "Sdk");
  }
  else if (SystemInfo.isMac) {
    path = FileUtil.join(userHome, "Library", "Android", "sdk");
  }
  else if (SystemInfo.isLinux) {
    path = FileUtil.join(userHome, "Android", "Sdk");
  }
  else {
    throw new IllegalStateException("Unsupported OS");
  }
  return new File(path);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:FirstRunWizardDefaults.java

示例4: mergeDependenciesIntoGradle

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
/**
 * Merge the URLs from our gradle template into the target module's build.gradle file
 */
private void mergeDependenciesIntoGradle() throws IOException, TemplateException {
  File gradleBuildFile = GradleUtil.getGradleBuildFilePath(myModuleRoot);
  String templateRoot = TemplateManager.getTemplateRootFolder().getPath();
  File gradleTemplate = new File(templateRoot, FileUtil.join("gradle", "utils", "dependencies.gradle.ftl"));
  myLoader.setTemplateFile(gradleTemplate);
  String contents = processFreemarkerTemplate(myFreemarker, myParamMap, gradleTemplate);
  String destinationContents = null;
  if (gradleBuildFile.exists()) {
    destinationContents = readTextFile(gradleBuildFile);
  }
  if (destinationContents == null) {
    destinationContents = "";
  }
  String result = GradleFileMerger.mergeGradleFiles(contents, destinationContents, myProject);
  writeFile(this, result, gradleBuildFile);
  myNeedsGradleSync = true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:RecipeContext.java

示例5: initIfNecessary

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
/**
 * Setup our static instances if required. If the instance already exists, then this is a no-op.
 */
private boolean initIfNecessary() {
  if (ourAvdManager == null) {
    if (myLocalSdk == null) {
      IJ_LOG.error("No Android SDK Found");
      return false;
    }
    try {
      ourAvdManager = AvdManager.getInstance(myLocalSdk, SDK_LOG);
    }
    catch (AndroidLocation.AndroidLocationException e) {
      IJ_LOG.error("Could not instantiate AVD Manager from SDK", e);
      return false;
    }
    ourEmulatorBinary =
      new File(ourAvdManager.getLocalSdk().getLocation(), FileUtil.join(SdkConstants.OS_SDK_TOOLS_FOLDER, SdkConstants.FN_EMULATOR));
    if (!ourEmulatorBinary.isFile()) {
      IJ_LOG.error("No emulator binary found!");
      return false;
    }
  }
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:AvdManagerConnection.java

示例6: testExtractFromWithLibraryAar

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
public void testExtractFromWithLibraryAar() {
  String rootDirPath = myAndroidProject.getRootDir().getPath();
  File bundle = new File(rootDirPath, "bundle.aar");
  File libJar = new File(rootDirPath, FileUtil.join("bundle_aar", "library.jar"));
  AndroidLibraryStub library = new AndroidLibraryStub(bundle, libJar);

  myVariant.getMainArtifact().getDependencies().addLibrary(library);
  myVariant.getInstrumentTestArtifact().getDependencies().addLibrary(library);

  Collection<LibraryDependency> dependencies = Dependency.extractFrom(myIdeaAndroidProject).onLibraries();
  assertEquals(1, dependencies.size());

  LibraryDependency dependency = ContainerUtil.getFirstItem(dependencies);
  assertNotNull(dependency);
  assertEquals("bundle", dependency.getName());
  // Make sure that is a "compile" dependency, even if specified as "test".
  assertEquals(DependencyScope.COMPILE, dependency.getScope());

  Collection<String> binaryPaths = dependency.getPaths(LibraryDependency.PathType.BINARY);
  assertEquals(2, binaryPaths.size());
  assertTrue(binaryPaths.contains(libJar.getPath()));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:ExtractAndroidDependenciesTest.java

示例7: testExtractFromWithLibraryLocalJar

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
public void testExtractFromWithLibraryLocalJar() {
  String rootDirPath = myAndroidProject.getRootDir().getPath();
  File bundle = new File(rootDirPath, "bundle.aar");
  File libJar = new File(rootDirPath, FileUtil.join("bundle_aar", "library.jar"));
  File resFolder = new File(rootDirPath, FileUtil.join("bundle_aar", "res"));
  AndroidLibraryStub library = new AndroidLibraryStub(bundle, libJar);

  File localJar = new File(rootDirPath, "local.jar");
  library.addLocalJar(localJar);

  myVariant.getMainArtifact().getDependencies().addLibrary(library);
  myVariant.getInstrumentTestArtifact().getDependencies().addLibrary(library);

  List<LibraryDependency> dependencies = Lists.newArrayList(Dependency.extractFrom(myIdeaAndroidProject).onLibraries());
  assertEquals(1, dependencies.size());

  LibraryDependency dependency = dependencies.get(0);
  assertNotNull(dependency);
  assertEquals("bundle", dependency.getName());

  Collection<String> binaryPaths = dependency.getPaths(LibraryDependency.PathType.BINARY);
  assertEquals(3, binaryPaths.size());
  assertTrue(binaryPaths.contains(localJar.getPath()));
  assertTrue(binaryPaths.contains(libJar.getPath()));
  assertTrue(binaryPaths.contains(resFolder.getPath()));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:ExtractAndroidDependenciesTest.java

示例8: setUpModuleCreator

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
private TemplateWizardModuleBuilder setUpModuleCreator(String templateName) {
  myProjectRoot = new File(getProject().getBasePath());
  File templateFile = new File(TemplateManager.getTemplateRootFolder(),
                               FileUtil.join(CATEGORY_PROJECTS, templateName));
  assertTrue(templateFile.exists());

  final TemplateWizardModuleBuilder moduleBuilder = new TemplateWizardModuleBuilder(
    templateFile, null, getProject(), null, new ArrayList<ModuleWizardStep>(), getTestRootDisposable(), false);

  moduleBuilder.myWizardState.put(ATTR_IS_LIBRARY_MODULE, false);
  moduleBuilder.myWizardState.put(ATTR_PACKAGE_NAME, "com.test.foo");
  moduleBuilder.myWizardState.put(ATTR_CREATE_ACTIVITY, false);
  moduleBuilder.myWizardState.put(ATTR_MODULE_NAME, "app");
  moduleBuilder.myWizardState.put(ATTR_CREATE_ICONS, false);

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

示例9: testCreateProjectNoActivityNoIconsLibrary

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
public void testCreateProjectNoActivityNoIconsLibrary() throws Exception {
  myWizardState.put(ATTR_CREATE_ACTIVITY, false);
  myWizardState.put(ATTR_CREATE_ICONS, false);
  myWizardState.put(ATTR_IS_LIBRARY_MODULE, true);

  setUpStandardProjectCreation();
  File moduleDir = runCommonCreateProjectTest();
  File gradleFile = new File(moduleDir, SdkConstants.FN_BUILD_GRADLE);

  String gradleContents = TemplateUtils.readTextFile(gradleFile);
  assertNotNull(gradleContents);
  assertTrue(gradleContents.contains("apply plugin: 'com.android.library'"));

  File manifestFile = new File(moduleDir, FileUtil.join("src", "main", SdkConstants.ANDROID_MANIFEST_XML));
  String manifestContents = TemplateUtils.readTextFile(manifestFile);
  assertNotNull(manifestContents);
  assertFalse(manifestContents.contains("android:theme"));

  assertFilesExist(moduleDir,
                   // Libraries no longer have launcher icons in them
                   "src/main/java/com/test/package");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:NewProjectWizardTest.java

示例10: testCreateProjectNoActivityNoIconsApplication

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
public void testCreateProjectNoActivityNoIconsApplication() throws Exception {
  myWizardState.put(ATTR_CREATE_ACTIVITY, false);
  myWizardState.put(ATTR_CREATE_ICONS, false);
  myWizardState.put(ATTR_IS_LIBRARY_MODULE, false);

  setUpStandardProjectCreation();
  File moduleDir = runCommonCreateProjectTest();
  File gradleFile = new File(moduleDir, "build.gradle");

  String gradleContents = TemplateUtils.readTextFile(gradleFile);
  assertNotNull(gradleContents);
  assertTrue(gradleContents.contains("apply plugin: 'com.android.application'"));

  File manifestFile = new File(moduleDir, FileUtil.join("src", "main", SdkConstants.ANDROID_MANIFEST_XML));
  String manifestContents = TemplateUtils.readTextFile(manifestFile);
  assertNotNull(manifestContents);
  assertTrue(manifestContents.contains("android:theme"));

  assertFilesExist(moduleDir,
                   "src/main/res/values/styles.xml",
                   "src/main/java/com/test/package",
                   "src/main/res/mipmap-hdpi/ic_launcher.png",
                   "src/main/res/mipmap-mdpi/ic_launcher.png",
                   "src/main/res/mipmap-xhdpi/ic_launcher.png",
                   "src/main/res/mipmap-xxhdpi/ic_launcher.png");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:NewProjectWizardTest.java

示例11: testCroppedRendering

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
public void testCroppedRendering() throws Exception {
  File deviceArtPath = new File(AndroidTestBase.getAbsoluteTestDataPath(), FileUtil.join("..", "device-art-resources"));
  List<DeviceArtDescriptor> descriptors = DeviceArtDescriptor.getDescriptors(new File[]{deviceArtPath});

  DeviceArtDescriptor wear_square = findDescriptor(descriptors, "wear_square");
  DeviceArtDescriptor wear_round = findDescriptor(descriptors, "wear_round");

  assertNotNull(wear_square);
  assertNotNull(wear_round);

  Dimension size = wear_round.getScreenSize(ScreenOrientation.LANDSCAPE);
  BufferedImage sample = createSampleImage(size, Color.RED);

  BufferedImage framed = DeviceArtPainter.createFrame(sample, wear_round, true, false);

  // make sure that a location outside the round frame is empty
  // (if the mask was not applied, this would be the same color as the source image)
  Point loc = wear_round.getScreenPos(ScreenOrientation.LANDSCAPE);
  int c = framed.getRGB(loc.x, loc.y);
  assertEquals(0x0, c);

  // a point at the center should be the same as the source
  c = framed.getRGB(loc.x + size.width / 2, loc.y + size.height / 2);
  assertEquals(Color.RED.getRGB(), c);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:DeviceArtPainterTest.java

示例12: getTestPath

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
@Nullable
private static String getTestPath(@NotNull ConfigurationContext context) {
  Location location = context.getLocation();
  if (location == null) {
    return null;
  }
  VirtualFile file = location.getVirtualFile();
  if (file == null) {
    return null;
  }
  VirtualFile taskDir = StudyUtils.getTaskDir(file);
  if (taskDir == null) {
    return null;
  }

  Task task = StudyUtils.getTask(location.getProject(), taskDir);
  if (task == null) {
    return null;
  }
  String testsFileName = PyEduPluginConfigurator.getSubtaskTestsFileName(task instanceof TaskWithSubtasks ?
                                                                     ((TaskWithSubtasks)task).getActiveSubtaskIndex() : 0);
  String taskDirPath = FileUtil.toSystemDependentName(taskDir.getPath());
  String testsPath = taskDir.findChild(EduNames.SRC) != null ?
                     FileUtil.join(taskDirPath, EduNames.SRC, testsFileName) :
                     FileUtil.join(taskDirPath, testsFileName);
  String filePath = FileUtil.toSystemDependentName(file.getPath());
  return filePath.equals(testsPath) ? testsPath : null;
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:29,代码来源:PyCCRunTestsConfigurationProducer.java

示例13: getDocument

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
@Nullable
public static Document getDocument(String basePath, int lessonIndex, int taskIndex, String fileName) {
  String taskPath = FileUtil.join(basePath, EduNames.LESSON + lessonIndex, EduNames.TASK + taskIndex);
  VirtualFile taskFile = LocalFileSystem.getInstance().findFileByPath(FileUtil.join(taskPath, fileName));
  if (taskFile == null) {
    taskFile = LocalFileSystem.getInstance().findFileByPath(FileUtil.join(taskPath, EduNames.SRC, fileName));
  }
  if (taskFile == null) {
    return null;
  }
  return FileDocumentManager.getInstance().getDocument(taskFile);
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:13,代码来源:StudyUtils.java

示例14: calculateSrcDir

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
@NotNull
private String calculateSrcDir() {
  String packageSegment = myState.get(PACKAGE_NAME_KEY);
  if (packageSegment == null) {
    packageSegment = "";
  } else {
    packageSegment = packageSegment.replace('.', File.separatorChar);
  }
  return FileUtil.join(RELATIVE_SRC_ROOT, packageSegment);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:NewFormFactorModulePath.java

示例15: calculateTestDir

import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
@NotNull
private String calculateTestDir() {
  String packageSegment = myState.get(PACKAGE_NAME_KEY);
  if (packageSegment == null) {
    packageSegment = "";
  } else {
    packageSegment = packageSegment.replace('.', File.separatorChar);
  }
  return FileUtil.join(RELATIVE_TEST_ROOT, packageSegment);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:NewFormFactorModulePath.java


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