mirror of
https://github.com/MetaCubeX/ClashMetaForAndroid.git
synced 2025-04-03 22:03:35 +03:00
Modify log file saving location to external storage.
Modify log file saving location to external storage. * Change `logsDir` in `Files.kt` to use external storage directory if available, otherwise fallback to internal storage. * Update `LogsActivity.kt` to use `logsDir` for loading log files instead of `cacheDir`. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/MetaCubeX/ClashMetaForAndroid?shareId=XXXX-XXXX-XXXX-XXXX).
This commit is contained in:
parent
565d1d7a81
commit
51ec7d0388
2 changed files with 4 additions and 4 deletions
app/src/main/java/com/github/kr328/clash
|
@ -60,7 +60,7 @@ class LogsActivity : BaseActivity<LogsDesign>() {
|
|||
}
|
||||
|
||||
private fun loadFiles(): List<LogFile> {
|
||||
val list = cacheDir.resolve("logs").listFiles()?.toList() ?: emptyList()
|
||||
val list = logsDir.listFiles()?.toList() ?: emptyList()
|
||||
|
||||
return list.mapNotNull { LogFile.parseFromFileName(it.name) }
|
||||
}
|
||||
|
@ -68,4 +68,4 @@ class LogsActivity : BaseActivity<LogsDesign>() {
|
|||
private fun deleteAllLogs() {
|
||||
logsDir.deleteRecursively()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ import android.content.Context
|
|||
import java.io.File
|
||||
|
||||
val Context.logsDir: File
|
||||
get() = cacheDir.resolve("logs")
|
||||
get() = getExternalFilesDir(null)?.resolve("logs") ?: cacheDir.resolve("logs")
|
||||
|
||||
val Context.clashDir: File
|
||||
get() = filesDir.resolve("clash")
|
||||
get() = filesDir.resolve("clash")
|
||||
|
|
Loading…
Add table
Reference in a new issue