ch.qos.logback.core.util.FileUtil.createMissingParentDirectories()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(213)

本文整理了Java中ch.qos.logback.core.util.FileUtil.createMissingParentDirectories()方法的一些代码示例,展示了FileUtil.createMissingParentDirectories()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtil.createMissingParentDirectories()方法的具体详情如下:
包路径:ch.qos.logback.core.util.FileUtil
类名称:FileUtil
方法名:createMissingParentDirectories

FileUtil.createMissingParentDirectories介绍

[英]Creates the parent directories of a file. If parent directories not specified in file's path, then nothing is done and this returns gracefully.
[中]创建文件的父目录。若在文件的路径中并没有指定父目录,那个么什么也不做,这将正常返回。

代码示例

代码示例来源:origin: camunda/camunda-bpm-platform

void createMissingTargetDirsIfNecessary(File toFile) throws RolloverFailure {
 if (FileUtil.isParentDirectoryCreationRequired(toFile)) {
  boolean result = FileUtil.createMissingParentDirectories(toFile);
  if (!result) {
   throw new RolloverFailure("Failed to create parent directories for ["
       + toFile.getAbsolutePath() + "]");
  }
 }
}

代码示例来源:origin: camunda/camunda-bpm-platform

void createMissingTargetDirsIfNecessary(File file) {
 if (FileUtil.isParentDirectoryCreationRequired(file)) {
  boolean result = FileUtil.createMissingParentDirectories(file);
  if (!result) {
   addError("Failed to create parent directories for ["
       + file.getAbsolutePath() + "]");
  } else {
   addInfo("Created missing parent directories for ["
       + file.getAbsolutePath() + "]");
  }
 }
}

代码示例来源:origin: camunda/camunda-bpm-platform

File file = new File(file_name);
if (FileUtil.isParentDirectoryCreationRequired(file)) {
 boolean result = FileUtil.createMissingParentDirectories(file);
 if (!result) {
  addError("Failed to create parent directories for ["

代码示例来源:origin: tony19/logback-android

void createMissingTargetDirsIfNecessary(File toFile) throws RolloverFailure {
 boolean result = FileUtil.createMissingParentDirectories(toFile);
 if (!result) {
  throw new RolloverFailure("Failed to create parent directories for ["
      + toFile.getAbsolutePath() + "]");
 }
}

代码示例来源:origin: tony19/logback-android

void createMissingTargetDirsIfNecessary(File file) {
 boolean result = FileUtil.createMissingParentDirectories(file);
 if (!result) {
  addError("Failed to create parent directories for ["
      + file.getAbsolutePath() + "]");
 }
}

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

void createMissingTargetDirsIfNecessary(File toFile) throws RolloverFailure {
  boolean result = FileUtil.createMissingParentDirectories(toFile);
  if (!result) {
    throw new RolloverFailure("Failed to create parent directories for [" + toFile.getAbsolutePath() + "]");
  }
}

代码示例来源:origin: io.virtdata/virtdata-lib-realer

void createMissingTargetDirsIfNecessary(File file) {
  boolean result = FileUtil.createMissingParentDirectories(file);
  if (!result) {
    addError("Failed to create parent directories for [" + file.getAbsolutePath() + "]");
  }
}

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

void createMissingTargetDirsIfNecessary(File file) {
  boolean result = FileUtil.createMissingParentDirectories(file);
  if (!result) {
    addError("Failed to create parent directories for [" + file.getAbsolutePath() + "]");
  }
}

代码示例来源:origin: com.hynnet/logback-core

void createMissingTargetDirsIfNecessary(File toFile) throws RolloverFailure {
 boolean result = FileUtil.createMissingParentDirectories(toFile);
 if (!result) {
  throw new RolloverFailure("Failed to create parent directories for ["
      + toFile.getAbsolutePath() + "]");
 }
}

代码示例来源:origin: com.hynnet/logback-core

void createMissingTargetDirsIfNecessary(File file) {
 boolean result = FileUtil.createMissingParentDirectories(file);
 if (!result) {
  addError("Failed to create parent directories for ["
      + file.getAbsolutePath() + "]");
 }
}

代码示例来源:origin: io.virtdata/virtdata-lib-realer

void createMissingTargetDirsIfNecessary(File toFile) throws RolloverFailure {
  boolean result = FileUtil.createMissingParentDirectories(toFile);
  if (!result) {
    throw new RolloverFailure("Failed to create parent directories for [" + toFile.getAbsolutePath() + "]");
  }
}

代码示例来源:origin: ch.qos.logback/core

void createMissingTargetDirsIfNecessary(File toFile) throws RolloverFailure {
 if (FileUtil.isParentDirectoryCreationRequired(toFile)) {
  boolean result = FileUtil.createMissingParentDirectories(toFile);
  if (!result) {
   throw new RolloverFailure("Failed to create parent directories for ["
       + toFile.getAbsolutePath() + "]");
  }
 }
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/ch.qos.logback.core

void createMissingTargetDirsIfNecessary(File toFile) throws RolloverFailure {
 if (FileUtil.isParentDirectoryCreationRequired(toFile)) {
  boolean result = FileUtil.createMissingParentDirectories(toFile);
  if (!result) {
   throw new RolloverFailure("Failed to create parent directories for ["
       + toFile.getAbsolutePath() + "]");
  }
 }
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/ch.qos.logback.core

void createMissingTargetDirsIfNecessary(File file) {
 if (FileUtil.isParentDirectoryCreationRequired(file)) {
  boolean result = FileUtil.createMissingParentDirectories(file);
  if (!result) {
   addError("Failed to create parent directories for ["
       + file.getAbsolutePath() + "]");
  } else {
   addInfo("Created missing parent directories for ["
       + file.getAbsolutePath() + "]");
  }
 }
}

代码示例来源:origin: ch.qos.logback/core

void createMissingTargetDirsIfNecessary(File file) {
 if (FileUtil.isParentDirectoryCreationRequired(file)) {
  boolean result = FileUtil.createMissingParentDirectories(file);
  if (!result) {
   addError("Failed to create parent directories for ["
       + file.getAbsolutePath() + "]");
  } else {
   addInfo("Created missing parent directories for ["
       + file.getAbsolutePath() + "]");
  }
 }
}

代码示例来源:origin: tony19/logback-android

@Test
public void createParentDirIgnoresExistingDir() {
 String target = CoreTestConstants.OUTPUT_DIR_PREFIX + "/fu" + diff + "/testing.txt";
 File file = new File(target);
 cleanupList.add(file);
 file.mkdirs();
 assertTrue(file.getParentFile().exists());
 assertTrue(FileUtil.createMissingParentDirectories(file));
}

代码示例来源:origin: tony19/logback-android

@Test
public void checkParentCreationInquiryAndSubsequentCreation() {
 File file = new File(CoreTestConstants.OUTPUT_DIR_PREFIX+"/fu"+diff+"/testing.txt");
 // these will be deleted later
 cleanupList.add(file);
 cleanupList.add(file.getParentFile());
 assertFalse(file.getParentFile().exists());
 assertTrue(FileUtil.createMissingParentDirectories(file));
 assertTrue(file.getParentFile().exists());
}

代码示例来源:origin: tony19/logback-android

@Test
public void checkDeeperParentCreationInquiryAndSubsequentCreation() {
 File file = new File(CoreTestConstants.OUTPUT_DIR_PREFIX+"/fu"+diff+"/bla/testing.txt");
 // these will be deleted later
 cleanupList.add(file);
 cleanupList.add(file.getParentFile());
 cleanupList.add(file.getParentFile().getParentFile());
 assertFalse(file.getParentFile().exists());
 assertTrue(FileUtil.createMissingParentDirectories(file));
 assertTrue(file.getParentFile().exists());
}

代码示例来源:origin: tony19/logback-android

@Test
 public void createParentDirAcceptsNoParentSpecified() {
  File file = new File("testing.txt");
  assertTrue(FileUtil.createMissingParentDirectories(file));
 }
}

代码示例来源:origin: tony19/logback-android

@Test
public void filesOnSameFolderShouldBeOnTheSameFileStore() throws RolloverFailure, IOException {
 if(!EnvUtil.isJDK7OrHigher())
  return;
 File parent = new File(pathPrefix);
 File file = new File(pathPrefix+"filesOnSameFolderShouldBeOnTheSameFileStore");
 FileUtil.createMissingParentDirectories(file);
 file.createNewFile();
 assertTrue(FileStoreUtil.areOnSameFileStore(parent, file));
}

相关文章