mirror of
https://github.com/SimpleMobileTools/Simple-File-Manager.git
synced 2025-06-05 22:09:15 +02:00
check OTG path after launching the app
This commit is contained in:
@ -178,6 +178,7 @@ class MainActivity : SimpleActivity() {
|
|||||||
|
|
||||||
private fun tryInitFileManager() {
|
private fun tryInitFileManager() {
|
||||||
handlePermission(PERMISSION_WRITE_STORAGE) {
|
handlePermission(PERMISSION_WRITE_STORAGE) {
|
||||||
|
checkOTGPath()
|
||||||
if (it) {
|
if (it) {
|
||||||
initFileManager()
|
initFileManager()
|
||||||
} else {
|
} 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) {
|
private fun openPath(path: String, forceRefresh: Boolean = false) {
|
||||||
if (mIsPasswordProtectionPending && !mWasProtectionHandled) {
|
if (mIsPasswordProtectionPending && !mWasProtectionHandled) {
|
||||||
return
|
return
|
||||||
|
Reference in New Issue
Block a user