From 23f8d055226e65915eb6a17c6348de6202666dcd Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Thu, 28 Oct 2021 13:35:39 +0100 Subject: [PATCH] removing redundant exists() checks, mkdirs already does this --- .../internal/session/sync/RoomSyncEphemeralTemporaryStore.kt | 4 +++- .../im/vector/app/features/voice/AbstractVoiceRecorder.kt | 4 +--- .../java/im/vector/app/features/voice/VoicePlayerHelper.kt | 4 +--- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/RoomSyncEphemeralTemporaryStore.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/RoomSyncEphemeralTemporaryStore.kt index c95c3bff91..8c68e224dc 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/RoomSyncEphemeralTemporaryStore.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/RoomSyncEphemeralTemporaryStore.kt @@ -40,7 +40,9 @@ internal class RoomSyncEphemeralTemporaryStoreFile @Inject constructor( ) : RoomSyncEphemeralTemporaryStore { 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) diff --git a/vector/src/main/java/im/vector/app/features/voice/AbstractVoiceRecorder.kt b/vector/src/main/java/im/vector/app/features/voice/AbstractVoiceRecorder.kt index 794130d528..786920aa22 100644 --- a/vector/src/main/java/im/vector/app/features/voice/AbstractVoiceRecorder.kt +++ b/vector/src/main/java/im/vector/app/features/voice/AbstractVoiceRecorder.kt @@ -28,9 +28,7 @@ abstract class AbstractVoiceRecorder( ) : VoiceRecorder { private val outputDirectory: File by lazy { File(context.cacheDir, "voice_records").also { - if (!it.exists()) { - it.mkdirs() - } + it.mkdirs() } } diff --git a/vector/src/main/java/im/vector/app/features/voice/VoicePlayerHelper.kt b/vector/src/main/java/im/vector/app/features/voice/VoicePlayerHelper.kt index 64b06a72f8..d2f7927d75 100644 --- a/vector/src/main/java/im/vector/app/features/voice/VoicePlayerHelper.kt +++ b/vector/src/main/java/im/vector/app/features/voice/VoicePlayerHelper.kt @@ -29,9 +29,7 @@ class VoicePlayerHelper @Inject constructor( ) { private val outputDirectory: File by lazy { File(context.cacheDir, "voice_records").also { - if (!it.exists()) { - it.mkdirs() - } + it.mkdirs() } }