removing redundant exists() checks, mkdirs already does this

This commit is contained in:
Adam Brown 2021-10-28 13:35:39 +01:00
parent 8525925732
commit 23f8d05522
3 changed files with 5 additions and 7 deletions

View File

@ -40,7 +40,9 @@ internal class RoomSyncEphemeralTemporaryStoreFile @Inject constructor(
) : RoomSyncEphemeralTemporaryStore { ) : RoomSyncEphemeralTemporaryStore {
private val workingDir: File by lazy { private val workingDir: File by lazy {
File(fileDirectory, "rr").also { it.mkdirs() } File(fileDirectory, "rr").also {
it.mkdirs()
}
} }
private val roomSyncEphemeralAdapter = moshi.adapter(RoomSyncEphemeral::class.java) private val roomSyncEphemeralAdapter = moshi.adapter(RoomSyncEphemeral::class.java)

View File

@ -28,11 +28,9 @@ abstract class AbstractVoiceRecorder(
) : VoiceRecorder { ) : VoiceRecorder {
private val outputDirectory: File by lazy { private val outputDirectory: File by lazy {
File(context.cacheDir, "voice_records").also { File(context.cacheDir, "voice_records").also {
if (!it.exists()) {
it.mkdirs() it.mkdirs()
} }
} }
}
private var mediaRecorder: MediaRecorder? = null private var mediaRecorder: MediaRecorder? = null
private var outputFile: File? = null private var outputFile: File? = null

View File

@ -29,11 +29,9 @@ class VoicePlayerHelper @Inject constructor(
) { ) {
private val outputDirectory: File by lazy { private val outputDirectory: File by lazy {
File(context.cacheDir, "voice_records").also { File(context.cacheDir, "voice_records").also {
if (!it.exists()) {
it.mkdirs() it.mkdirs()
} }
} }
}
/** /**
* Ensure the file is encoded using aac audio codec * Ensure the file is encoded using aac audio codec