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


Java VfsUtil.createDirectoryIfMissing方法代码示例

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


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

示例1: createChildFile

import com.intellij.openapi.vfs.VfsUtil; //导入方法依赖的package包/类
public static void createChildFile(@NotNull VirtualFile taskDir, @NotNull String name, @NotNull String text) throws IOException {
  String newDirectories = null;
  String fileName = name;
  VirtualFile dir = taskDir;
  if (name.contains("/")) {
    int pos = name.lastIndexOf("/");
    fileName = name.substring(pos + 1);
    newDirectories = name.substring(0, pos);
  }
  if (newDirectories != null) {
    dir = VfsUtil.createDirectoryIfMissing(taskDir, newDirectories);
  }
  if (dir != null) {
    VirtualFile virtualTaskFile = dir.findChild(fileName);
    if (virtualTaskFile == null) {
      virtualTaskFile = dir.createChildData(taskDir, fileName);
    }
    if (EduUtils.isImage(name)) {
      virtualTaskFile.setBinaryContent(Base64.decodeBase64(text));
    }
    else {
      VfsUtil.saveText(virtualTaskFile, text);
    }
  }
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:26,代码来源:StudyGenerator.java

示例2: getOrCreateDestinationPath

import com.intellij.openapi.vfs.VfsUtil; //导入方法依赖的package包/类
private static VirtualFile getOrCreateDestinationPath(VirtualFile rootDirectory, String destinationPath) {
    try {
        return VfsUtil.createDirectoryIfMissing(rootDirectory, destinationPath);
    } catch (IOException e) {
        e.printStackTrace();
    }

    return null;
}
 
开发者ID:cedricziel,项目名称:idea-php-typo3-plugin,代码行数:10,代码来源:ExtensionFileGenerationUtil.java

示例3: createLesson

import com.intellij.openapi.vfs.VfsUtil; //导入方法依赖的package包/类
public static void createLesson(@NotNull final Lesson lesson, @NotNull final VirtualFile courseDir) throws IOException {
  if (EduNames.PYCHARM_ADDITIONAL.equals(lesson.getName())) {
    createAdditionalFiles(lesson, courseDir);
  }
  else {
    String lessonDirName = EduNames.LESSON + Integer.toString(lesson.getIndex());
    VirtualFile lessonDir = VfsUtil.createDirectoryIfMissing(courseDir, lessonDirName);
    final List<Task> taskList = lesson.getTaskList();
    for (int i = 1; i <= taskList.size(); i++) {
      Task task = taskList.get(i - 1);
      task.setIndex(i);
      createTask(task, lessonDir);
    }
  }
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:16,代码来源:StudyGenerator.java

示例4: run

import com.intellij.openapi.vfs.VfsUtil; //导入方法依赖的package包/类
@Override
protected void run(@NotNull Result<Object> result) throws Throwable {
  File moduleLocation = GradleUtil.getModuleDefaultPath(myProject.getBaseDir(), myGradlePath);
  try {
    VirtualFile moduleRoot = VfsUtil.createDirectoryIfMissing(moduleLocation.getAbsolutePath());
    VirtualFile sourceFile = VfsUtil.findFileByIoFile(myArchivePath, true);
    if (sourceFile != null && moduleRoot != null) {
      if (myMove) {
        sourceFile.move(this, moduleRoot);
      }
      else {
        VfsUtil.copy(this, sourceFile, moduleRoot);
      }
      VirtualFile buildGradle = moduleRoot.createChildData(this, SdkConstants.FN_BUILD_GRADLE);
      VfsUtil.saveText(buildGradle, getBuildGradleText(myArchivePath));
      if (mySettingsFile == null) {
        mySettingsFile = GradleSettingsFile.getOrCreate(myProject);
      }
      mySettingsFile.addModule(myGradlePath, VfsUtilCore.virtualToIoFile(moduleRoot));
      for (Module module : myModulesToAddDependency) {
        addDependency(module, myGradlePath);
      }
    }
  }
  catch (IOException e) {
    Logger.getInstance(WrapArchiveWizardPath.class).error(e);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:CreateModuleFromArchiveAction.java

示例5: suggestParentDirectoryForAppEngineWebXml

import com.intellij.openapi.vfs.VfsUtil; //导入方法依赖的package包/类
@Nullable
@Override
public VirtualFile suggestParentDirectoryForAppEngineWebXml(@NotNull Module module, @NotNull ModifiableRootModel rootModel) {
  final VirtualFile root = ArrayUtil.getFirstElement(rootModel.getContentRoots());
  if (root != null) {
    try {
      return VfsUtil.createDirectoryIfMissing(root, "WEB-INF");
    }
    catch (IOException e) {
      LOG.info(e);
      return null;
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:AppEngineCommunityWebIntegration.java

示例6: createTask

import com.intellij.openapi.vfs.VfsUtil; //导入方法依赖的package包/类
public static void createTask(@NotNull final Task task, @NotNull final VirtualFile lessonDir) throws IOException {
  String name = EduNames.TASK + Integer.toString(task.getIndex());
  VirtualFile taskDir = VfsUtil.createDirectoryIfMissing(lessonDir, name);
  createTaskContent(task, taskDir);
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:6,代码来源:StudyGenerator.java


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