本文整理汇总了Java中com.intellij.openapi.util.io.FileUtil.createDirectory方法的典型用法代码示例。如果您正苦于以下问题:Java FileUtil.createDirectory方法的具体用法?Java FileUtil.createDirectory怎么用?Java FileUtil.createDirectory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.util.io.FileUtil
的用法示例。
在下文中一共展示了FileUtil.createDirectory方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doCreateDeploymentRuntime
import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
@Override
protected CloudDeploymentRuntime doCreateDeploymentRuntime(ArtifactDeploymentSource artifactSource,
File artifactFile,
CloudMultiSourceServerRuntimeInstance serverRuntime,
DeploymentTask<? extends CloudDeploymentNameConfiguration> deploymentTask,
DeploymentLogManager logManager) throws ServerRuntimeException {
RepositoryDeploymentConfiguration config = (RepositoryDeploymentConfiguration)deploymentTask.getConfiguration();
String repositoryPath = config.getRepositoryPath();
File repositoryRootFile;
if (StringUtil.isEmpty(repositoryPath)) {
File repositoryParentFolder = new File(PathManager.getSystemPath(), "cloud-git-artifact-deploy");
repositoryRootFile = FileUtil.findSequentNonexistentFile(repositoryParentFolder, artifactFile.getName(), "");
}
else {
repositoryRootFile = new File(repositoryPath);
}
if (!FileUtil.createDirectory(repositoryRootFile)) {
throw new ServerRuntimeException("Unable to create deploy folder: " + repositoryRootFile);
}
config.setRepositoryPath(repositoryRootFile.getAbsolutePath());
return doCreateDeploymentRuntime(artifactSource, artifactFile, serverRuntime, deploymentTask, logManager, repositoryRootFile);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:RepositoryArtifactDeploymentRuntimeProviderBase.java
示例2: moveToDir
import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
private static List<Pair<File, DownloadableFileDescription>> moveToDir(List<Pair<File, DownloadableFileDescription>> downloadedFiles,
final File targetDir) throws IOException {
FileUtil.createDirectory(targetDir);
List<Pair<File, DownloadableFileDescription>> result = new ArrayList<Pair<File, DownloadableFileDescription>>();
for (Pair<File, DownloadableFileDescription> pair : downloadedFiles) {
final DownloadableFileDescription description = pair.getSecond();
final String fileName = description.generateFileName(new Condition<String>() {
@Override
public boolean value(String s) {
return !new File(targetDir, s).exists();
}
});
final File toFile = new File(targetDir, fileName);
FileUtil.rename(pair.getFirst(), toFile);
result.add(Pair.create(toFile, description));
}
return result;
}
示例3: flushCourse
import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
public void flushCourse(@NotNull final Course course) {
final File courseDirectory = new File(ourCoursesDir, course.getName());
FileUtil.createDirectory(courseDirectory);
flushCourseJson(course, courseDirectory);
int lessonIndex = 1;
for (Lesson lesson : course.getLessons()) {
if (lesson.getName().equals(EduNames.PYCHARM_ADDITIONAL)) {
flushAdditionalFiles(courseDirectory, lesson);
}
else {
final File lessonDirectory = new File(courseDirectory, EduNames.LESSON + String.valueOf(lessonIndex));
flushLesson(lessonDirectory, lesson);
lessonIndex += 1;
}
}
}
示例4: addOutputModuleRoots
import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
private static void addOutputModuleRoots(@Nullable ExternalSourceSet externalSourceSet,
@NotNull ExternalSystemSourceType sourceType,
@NotNull Collection<String> result) {
if (externalSourceSet == null) return;
final ExternalSourceDirectorySet directorySet = externalSourceSet.getSources().get(sourceType);
if (directorySet == null) return;
if (directorySet.isCompilerOutputPathInherited()) return;
final String path = directorySet.getOutputDir().getAbsolutePath();
VirtualFile virtualFile = VirtualFileManager.getInstance().findFileByUrl(path);
if (virtualFile == null) {
if(!directorySet.getOutputDir().exists()){
FileUtil.createDirectory(directorySet.getOutputDir());
}
ApplicationEx app = (ApplicationEx)ApplicationManager.getApplication();
if (app.isDispatchThread() || !app.holdsReadLock()) {
LocalFileSystem.getInstance().refreshAndFindFileByIoFile(directorySet.getOutputDir());
}
}
result.add(VfsUtilCore.pathToUrl(path));
}
示例5: getStorageDirectory
import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
@NotNull
private File getStorageDirectory() {
String dirName = myProject.getName() + "."+Integer.toHexString(myProject.getPresentableUrl().hashCode());
File dir = new File(PathManager.getSystemPath(), "refs/" + dirName);
FileUtil.createDirectory(dir);
return dir;
}
示例6: testSymlinkTargetBlink
import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
public void testSymlinkTargetBlink() throws Exception {
if (!SystemInfo.areSymLinksSupported) {
System.err.println("Ignored: symlinks not supported");
return;
}
File top = createTempDirectory(true);
File target = IoTestUtil.createTestDir(top, "target");
File link = IoTestUtil.createSymLink(target.getPath(), top.getPath() + "/link");
VirtualFile vTop = myFS.refreshAndFindFileByIoFile(top);
assertNotNull(vTop);
assertTrue(vTop.isValid());
VirtualFile vTarget = myFS.refreshAndFindFileByIoFile(target);
assertNotNull(vTarget);
assertTrue(vTarget.isValid());
VirtualFile vLink = myFS.refreshAndFindFileByIoFile(link);
assertNotNull(vLink);
assertTrue(vLink.isValid());
assertTrue(vLink.isDirectory());
FileUtil.delete(target);
vTop.refresh(false, true);
assertFalse(vTarget.isValid());
assertFalse(vLink.isValid());
vLink = myFS.refreshAndFindFileByIoFile(link);
assertNotNull(vLink);
assertTrue(vLink.isValid());
assertFalse(vLink.isDirectory());
FileUtil.createDirectory(target);
vTop.refresh(false, true);
assertFalse(vLink.isValid());
vLink = myFS.refreshAndFindFileByIoFile(link);
assertNotNull(vLink);
assertTrue(vLink.isValid());
assertTrue(vLink.isDirectory());
}
示例7: flushLesson
import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
public static void flushLesson(@NotNull final File lessonDirectory, @NotNull final Lesson lesson) {
FileUtil.createDirectory(lessonDirectory);
int taskIndex = 1;
for (Task task : lesson.taskList) {
final File taskDirectory = new File(lessonDirectory, EduNames.TASK + String.valueOf(taskIndex));
flushTask(task, taskDirectory);
taskIndex += 1;
}
}
示例8: generateTempSkeletonsOrPackages
import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
/**
* Adds installed eggs to SDK, generates skeletons (optionally) and associates it with modle.
*
* @param sdk sdk to process
* @param addSkeletons add skeletons or only packages
* @param module module to associate with (if provided)
* @throws InvalidSdkException bas sdk
* @throws IOException failed to read eggs
*/
private static void generateTempSkeletonsOrPackages(@NotNull final Sdk sdk,
final boolean addSkeletons,
@Nullable final Module module)
throws InvalidSdkException, IOException {
if (module != null) {
// Associate with module
final Project project = module.getProject();
ModuleRootModificationUtil.setModuleSdk(module, sdk);
UsefulTestCase.edt(new Runnable() {
@Override
public void run() {
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
ProjectRootManager.getInstance(project).setProjectSdk(sdk);
}
});
}
});
}
final SdkModificator modificator = sdk.getSdkModificator();
modificator.removeRoots(OrderRootType.CLASSES);
for (final String path : PythonSdkType.getSysPathsFromScript(sdk.getHomePath())) {
PythonSdkType.addSdkRoot(PySdkUpdater.fromSdkModificator(sdk, modificator), path);
}
if (!addSkeletons) {
UsefulTestCase.edt(new Runnable() {
@Override
public void run() {
modificator.commitChanges();
}
});
return;
}
final File tempDir = FileUtil.createTempDirectory(PyTestSdkTools.class.getName(), null);
final File skeletonsDir = new File(tempDir, PythonSdkType.SKELETON_DIR_NAME);
FileUtil.createDirectory(skeletonsDir);
final String skeletonsPath = skeletonsDir.toString();
PythonSdkType.addSdkRoot(PySdkUpdater.fromSdkModificator(sdk, modificator), skeletonsPath);
UsefulTestCase.edt(new Runnable() {
@Override
public void run() {
modificator.commitChanges();
}
});
final SkeletonVersionChecker checker = new SkeletonVersionChecker(0);
final PySkeletonRefresher refresher = new PySkeletonRefresher(null, null, sdk, skeletonsPath, null, null);
final List<String> errors = refresher.regenerateSkeletons(checker);
Assert.assertThat("Errors found", errors, Matchers.empty());
}
示例9: createDirectory
import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
@NotNull
private static File createDirectory(@NotNull File parent, @NotNull String name) {
File dir = new File(parent, name);
FileUtil.createDirectory(dir);
return dir;
}
示例10: patchJavaParameters
import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
public void patchJavaParameters(@Nullable final Module module, JavaParameters javaParameters) {
if (module != null && PsiUtil.isIdeaProject(module.getProject()) &&
!javaParameters.getVMParametersList().hasParameter(JAVA_SYSTEM_CLASS_LOADER_PROPERTY)) {
final JavaPsiFacade psiFacade = JavaPsiFacade.getInstance(module.getProject());
final String qualifiedName = UrlClassLoader.class.getName();
final PsiClass urlLoaderClass = ApplicationManager.getApplication().runReadAction(new Computable<PsiClass>() {
@Override
public PsiClass compute() {
return psiFacade.findClass(qualifiedName, GlobalSearchScope.moduleWithDependenciesAndLibrariesScope(module));
}
});
if (urlLoaderClass != null) {
javaParameters.getVMParametersList().add("-D" + JAVA_SYSTEM_CLASS_LOADER_PROPERTY + "=" + UrlClassLoader.class.getName());
}
}
Sdk jdk = javaParameters.getJdk();
jdk = IdeaJdk.findIdeaJdk(jdk);
if (jdk == null) return;
@NonNls String libPath = jdk.getHomePath() + File.separator + "lib";
final ParametersList vm = javaParameters.getVMParametersList();
vm.add("-Xbootclasspath/a:" + libPath + File.separator + "boot.jar");
if (!vm.hasProperty("idea.load.plugins.id") && module != null && PluginModuleType.isOfType(module)) {
final String id = DescriptorUtil.getPluginId(module);
if (id != null) {
vm.defineProperty("idea.load.plugins.id", id);
}
}
final File sandboxHome = getSandboxPath(jdk);
if (sandboxHome != null) {
if (!vm.hasProperty("idea.home.path")) {
File homeDir = new File(sandboxHome, "test");
FileUtil.createDirectory(homeDir);
vm.defineProperty("idea.home.path", homeDir.getAbsolutePath());
}
if (!vm.hasProperty("idea.plugins.path")) {
vm.defineProperty("idea.plugins.path", new File(sandboxHome, "plugins").getAbsolutePath());
}
}
javaParameters.getClassPath().addFirst(libPath + File.separator + "idea.jar");
javaParameters.getClassPath().addFirst(libPath + File.separator + "resources.jar");
javaParameters.getClassPath().addFirst(((JavaSdkType)jdk.getSdkType()).getToolsPath(jdk));
}