本文整理匯總了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));
}