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