private static Path backupCurrentConfigToTempAndDelete(Path currentConfig, Logger log, boolean smartDelete, @Nullable ConfigImportSettings settings) throws IOException {
    Path tempBackupDir = Files.createTempDirectory(currentConfig.getFileName() + "-backup-" + UUID.randomUUID());
    log.info("Backup config from " + currentConfig + " to " + tempBackupDir);
    FileUtil.copyDir(currentConfig.toFile(), tempBackupDir.toFile(), file -> !shouldSkipFileDuringImport(file.toPath(), settings));

    deleteCurrentConfigDir(currentConfig, log, smartDelete);

    Path pluginDir = currentConfig.getFileSystem().getPath(PathManager.getPluginsPath());
    if (Files.exists(pluginDir) && !pluginDir.startsWith(currentConfig)) {
      Path pluginBackup = tempBackupDir.resolve(PLUGINS);
      log.info("Backup plugins dir separately from " + pluginDir + " to " + pluginBackup);
      NioFiles.createDirectories(pluginBackup);
      FileUtil.copyDir(pluginDir.toFile(), pluginBackup.toFile());
      NioFiles.deleteRecursively(pluginDir);
    }

    return tempBackupDir;
  }
private static Path backupCurrentConfigToTempAndDelete(Path currentConfig, Logger log, boolean smartDelete, @Nullable ConfigImportSettings settings)