#1: Доделал рефакторинг
This commit is contained in:
@@ -37,7 +37,7 @@ class USBVirusScanner {
|
||||
private val scope = CoroutineScope(Dispatchers.IO + SupervisorJob())
|
||||
|
||||
fun initialize() {
|
||||
println("Инициализация...")
|
||||
println(if (DEBUG) "Инициализация..." else "")
|
||||
|
||||
try {
|
||||
// Проверяем доступность gpiod
|
||||
@@ -55,7 +55,7 @@ class USBVirusScanner {
|
||||
// Запускаем индикацию состояния
|
||||
startStateIndication()
|
||||
currentState = SystemState.IDLE
|
||||
Thread.sleep(500)
|
||||
Thread.sleep(1000)
|
||||
|
||||
println("Инициализация завершена.")
|
||||
|
||||
@@ -284,7 +284,7 @@ class USBVirusScanner {
|
||||
if (parts.size >= 2) {
|
||||
val mountPoint = parts[1]
|
||||
|
||||
if ((mountPoint.startsWith("/media") || mountPoint.startsWith("/mnt")) &&
|
||||
if ((mountPoint.startsWith("/media")) &&
|
||||
File(mountPoint).exists() &&
|
||||
devices.none { it.mountPoint == mountPoint }) {
|
||||
|
||||
@@ -340,8 +340,8 @@ class USBVirusScanner {
|
||||
"-r",
|
||||
"--stdout",
|
||||
"--infected",
|
||||
"--max-filesize=1G",
|
||||
"--max-scansize=1G",
|
||||
"--max-filesize=70M",
|
||||
"--max-scansize=150M",
|
||||
path
|
||||
)
|
||||
|
||||
@@ -364,6 +364,14 @@ class USBVirusScanner {
|
||||
}
|
||||
}
|
||||
|
||||
val syncProccessBuilder = ProcessBuilder("sync")
|
||||
syncProccessBuilder.start()
|
||||
process.waitFor()
|
||||
|
||||
val umountProcessBulder = ProcessBuilder("umount", "/dev/sda", "-f")
|
||||
umountProcessBulder.start()
|
||||
process.waitFor()
|
||||
|
||||
return ScanResult(
|
||||
isInfected = infectedFiles.isNotEmpty(),
|
||||
infectedFiles = infectedFiles,
|
||||
|
||||
Reference in New Issue
Block a user