@@ -150,9 +150,9 @@ internal interface FirebaseSessionsComponent {
150
150
},
151
151
scope = CoroutineScope (blockingDispatcher),
152
152
produceFile = {
153
- prepDataStoreFile(
154
- appContext.dataStoreFile( " firebaseSessions/sessionConfigsDataStore.data " )
155
- )
153
+ appContext.dataStoreFile( " firebaseSessions/sessionConfigsDataStore.data " ). also {
154
+ prepDataStoreFile(it )
155
+ }
156
156
},
157
157
)
158
158
@@ -172,7 +172,9 @@ internal interface FirebaseSessionsComponent {
172
172
},
173
173
scope = CoroutineScope (blockingDispatcher),
174
174
produceFile = {
175
- prepDataStoreFile(appContext.dataStoreFile(" firebaseSessions/sessionDataStore.data" ))
175
+ appContext.dataStoreFile(" firebaseSessions/sessionDataStore.data" ).also {
176
+ prepDataStoreFile(it)
177
+ }
176
178
},
177
179
)
178
180
@@ -211,8 +213,8 @@ internal interface FirebaseSessionsComponent {
211
213
* Prepares the DataStore file by ensuring its parent directory exists. Throws [IOException]
212
214
* if the directory could not be created, or if a conflicting file could not be removed.
213
215
*/
214
- private fun prepDataStoreFile (dataStoreFile : File ): File {
215
- val parentDir = dataStoreFile.parentFile ? : return dataStoreFile
216
+ private fun prepDataStoreFile (dataStoreFile : File ) {
217
+ val parentDir = dataStoreFile.parentFile ? : return
216
218
217
219
// Check if something exists at the path, but isn't a directory
218
220
if (parentDir.exists() && ! parentDir.isDirectory) {
@@ -225,7 +227,7 @@ internal interface FirebaseSessionsComponent {
225
227
}
226
228
227
229
if (parentDir.isDirectory) {
228
- return dataStoreFile
230
+ return
229
231
}
230
232
231
233
if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .O ) {
@@ -242,8 +244,6 @@ internal interface FirebaseSessionsComponent {
242
244
}
243
245
}
244
246
}
245
-
246
- return dataStoreFile
247
247
}
248
248
}
249
249
}
0 commit comments