check OTG path after launching the app
This commit is contained in:
parent
3e43ca3aec
commit
c2ba395720
|
@ -178,6 +178,7 @@ class MainActivity : SimpleActivity() {
|
|||
|
||||
private fun tryInitFileManager() {
|
||||
handlePermission(PERMISSION_WRITE_STORAGE) {
|
||||
checkOTGPath()
|
||||
if (it) {
|
||||
initFileManager()
|
||||
} else {
|
||||
|
@ -205,6 +206,17 @@ class MainActivity : SimpleActivity() {
|
|||
}
|
||||
}
|
||||
|
||||
private fun checkOTGPath() {
|
||||
Thread {
|
||||
if (!config.wasOTGHandled && hasPermission(PERMISSION_WRITE_STORAGE) && hasOTGConnected() && config.OTGPath.isEmpty()) {
|
||||
config.wasOTGHandled = true
|
||||
getStorageDirectories().firstOrNull { it.trimEnd('/') != internalStoragePath && it.trimEnd('/') != sdCardPath }?.apply {
|
||||
config.OTGPath = trimEnd('/')
|
||||
}
|
||||
}
|
||||
}.start()
|
||||
}
|
||||
|
||||
private fun openPath(path: String, forceRefresh: Boolean = false) {
|
||||
if (mIsPasswordProtectionPending && !mWasProtectionHandled) {
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue