Move SSD download access probe to typed Kotlin
ober
281ed4e0aae0b3acf76a48f8e70f89537eab6f4d
--- a/templates/ssd-review.ss +++ b/templates/ssd-review.ss @@ -1738,6 +1738,7 @@ TruthIndexEntry-truthTime betterTruthIndex fileExists fileIsDirectory fileIsNotDirectory fileIsRegular fileIsNotRegular + fileListFilesPresent fileIsSymbolicLink fileSizeBytes pathIsSymbolicLink pathNotSymbolicLink pathParentMatches @@ -1779,6 +1780,7 @@ (type URL) (type ZipEntry) (type Int32) + (type Any) (extern (fileExistsRaw (file : File)) : Bool (kotlin-member-call exists)) (extern (fileIsFile (file : File)) : Bool @@ -1789,6 +1791,8 @@ (kotlin-member-call length)) (extern (fileToPath (file : File)) : Path (kotlin-member-call toPath)) + (extern (fileListFilesRaw (file : File)) : (Nullable Any) + (kotlin-member-call listFiles)) (extern (pathIsSymbolicLinkRaw (path : Path)) : Bool (kotlin-call Files isSymbolicLink)) (extern (pathParent (path : Path)) : Path @@ -1844,6 +1848,8 @@ (and (fileExists file) (fileIsFile file))) (def (fileIsNotRegular (file : File)) : Bool (not (fileIsRegular file))) + (def (fileListFilesPresent (file : File)) : Bool + (not (nullable-null? (fileListFilesRaw file)))) (def (fileSizeBytes (file : File)) : Int (fileLength file)) (def (pathIsSymbolicLink (path : Path)) : Bool @@ -7394,7 +7400,7 @@ " }" " val dir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS)" " return try {" - " dir.listFiles() != null" + " fileListFilesPresent(dir)" " } catch (_: Exception) {" " false" " }"