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,9 +28,7 @@ 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()
}
} }
} }

View File

@ -29,9 +29,7 @@ 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()
}
} }
} }