Minor fixes and cleanups

This commit is contained in:
topjohnwu
2019-07-22 01:49:21 -07:00
parent 6fb032b3c2
commit 094c3d559a
12 changed files with 47 additions and 86 deletions
@@ -8,6 +8,7 @@ import android.content.pm.PackageManager
import android.content.res.Configuration
import android.content.res.Resources
import android.net.Uri
import android.os.Environment
import android.widget.Toast
import androidx.annotation.WorkerThread
import androidx.work.*
@@ -19,6 +20,7 @@ import com.topjohnwu.net.Networking
import com.topjohnwu.superuser.Shell
import com.topjohnwu.superuser.internal.UiThreadHandler
import com.topjohnwu.superuser.io.SuFile
import java.io.File
import java.util.*
import java.util.concurrent.TimeUnit
@@ -120,4 +122,9 @@ object Utils {
}
}
fun ensureDownloadPath(path : String) =
File(Environment.getExternalStorageDirectory(), path).run {
if ((exists() && isDirectory) || mkdirs()) this else null
}
}