mirror of
https://github.com/fromchat-messenger/app.git
synced 2026-09-23 03:25:06 +03:00
+32
@@ -0,0 +1,32 @@
|
||||
package com.pr0gramm3r101.utils.files
|
||||
|
||||
import com.pr0gramm3r101.utils.UtilsLibrary
|
||||
import java.io.File
|
||||
|
||||
internal actual fun expectExists(path: String): Boolean =
|
||||
File(path).exists()
|
||||
|
||||
internal actual fun expectWriteBytes(path: String, bytes: ByteArray) {
|
||||
File(path).writeBytes(bytes)
|
||||
}
|
||||
|
||||
internal actual fun expectDelete(path: String) {
|
||||
File(path).delete()
|
||||
}
|
||||
|
||||
internal actual fun expectDeleteFilesWithPrefix(dirPath: String, namePrefix: String) {
|
||||
val dir = File(dirPath)
|
||||
if (!dir.exists()) return
|
||||
dir.listFiles()?.forEach { file ->
|
||||
if (file.name.startsWith(namePrefix)) {
|
||||
file.delete()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal actual fun expectGetAppCacheDirectory(): String =
|
||||
UtilsLibrary.context.cacheDir.absolutePath
|
||||
|
||||
internal actual fun expectEnsureDirectory(path: String) {
|
||||
File(path).mkdirs()
|
||||
}
|
||||
Reference in New Issue
Block a user