Skip to content

Commit 8e2f490

Browse files
author
Chenhe
committed
调整日志保存路径
1 parent 5ceced1 commit 8e2f490

File tree

1 file changed

+10
-2
lines changed
  • app/src/main/java/cc/chenhe/qqnotifyevo/utils

1 file changed

+10
-2
lines changed

app/src/main/java/cc/chenhe/qqnotifyevo/utils/Utils.kt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,15 +116,23 @@ private fun getCacheDir(context: Context): File {
116116
}
117117
}
118118

119+
private fun getDataDir(context: Context): File {
120+
return if (Environment.MEDIA_MOUNTED == Environment.getExternalStorageState()
121+
|| !Environment.isExternalStorageRemovable()) {
122+
context.getExternalFilesDir(null)!!
123+
} else {
124+
context.filesDir
125+
}
126+
}
127+
119128
fun getAvatarDiskCacheDir(context: Context): File {
120129
return File(getCacheDir(context), "conversion_icon")
121130
}
122131

123132
fun getLogDir(context: Context): File {
124-
return File(getCacheDir(context), "log")
133+
return File(getDataDir(context), "log")
125134
}
126135

127-
128136
fun describeFileSize(size: Long): String {
129137
return if (size < 1000) {
130138
"${size}B"

0 commit comments

Comments
 (0)