|
|
|
@ -9,8 +9,7 @@ import android.os.Looper |
|
|
|
|
import android.util.Log |
|
|
|
|
import android.widget.Toast |
|
|
|
|
import io.legado.app.service.TTSReadAloudService |
|
|
|
|
import java.io.File |
|
|
|
|
import java.io.FileOutputStream |
|
|
|
|
import io.legado.app.utils.FileUtils |
|
|
|
|
import java.io.PrintWriter |
|
|
|
|
import java.io.StringWriter |
|
|
|
|
import java.text.SimpleDateFormat |
|
|
|
@ -141,14 +140,10 @@ class CrashHandler : Thread.UncaughtExceptionHandler { |
|
|
|
|
val timestamp = System.currentTimeMillis() |
|
|
|
|
val time = format.format(Date()) |
|
|
|
|
val fileName = "crash-$time-$timestamp.log" |
|
|
|
|
val path = mContext?.externalCacheDir?.toString() + "/crash/" |
|
|
|
|
val dir = File(path) |
|
|
|
|
if (!dir.exists()) { |
|
|
|
|
dir.mkdirs() |
|
|
|
|
mContext?.externalCacheDir?.let { |
|
|
|
|
FileUtils.createFileIfNotExist(it, fileName, "crash") |
|
|
|
|
.writeText(sb.toString()) |
|
|
|
|
} |
|
|
|
|
val fos = FileOutputStream(path + fileName) |
|
|
|
|
fos.write(sb.toString().toByteArray()) |
|
|
|
|
fos.close() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|