package mg.dot.feufaro


class AndroidPathValidator : PathValidator {
    override fun isRestrictedPath(path: String): Boolean {
        if (path.isEmpty()) return true
        if (path.startsWith("content://")) return false

        val lowerPath = path.lowercase()

        val isAndroidAsset = lowerPath.contains("android_asset") ||
                lowerPath.startsWith("assets/")

        val isAndroidCacheOrTmp = lowerPath.contains("/cache/") ||
                lowerPath.contains("/code_cache/") ||
                lowerPath.contains("/tmp/") ||
                lowerPath.contains("_tmp")

        return isAndroidAsset || isAndroidCacheOrTmp
    }
}

actual fun getPathValidator(): PathValidator = AndroidPathValidator()