fun downloadDir()

in aspoet/src/main/kotlin/com/google/androidstudiopoet/writers/GithubDownloader.kt [40:58]


    fun downloadDir(githubPath: String, to: String): Boolean {

        FileUtils.deleteDirectory(File(to))
        File(to).mkdirs()

        val list = listUrl(githubPath)
        val result = ArrayList<Boolean>()
        list?.forEach { item ->
            if ("dir" == item.type) {
                val newDir = File(to, item.name)
                result.add(downloadDir(item.url!!, newDir.absolutePath))
            } else {
                val file = File(to, item.name)
                file.createNewFile()
                result.add(downloadFile(item.download_url!!, file))
            }
        }
        return !result.contains(java.lang.Boolean.FALSE)
    }