This repository was archived by the owner on Nov 1, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
app-core/src/main/java/com/codee/app/core/plugins/files Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change 1
1
package com.codee.app.core.plugins.files
2
2
3
+ import kotlinx.coroutines.Dispatchers
4
+ import kotlinx.coroutines.withContext
3
5
import java.io.File
4
6
import com.codee.app.plugins.api.files.EmptyStorageElement as IEmptyStorageElement
5
7
6
8
class EmptyStorageElement (private val origin : File , private val rootDirectory : File ) :
7
9
IEmptyStorageElement {
8
- override suspend fun mkdir (): ChildDirectoryStorageElement {
10
+ override suspend fun mkdir (): ChildDirectoryStorageElement = withContext( Dispatchers . IO ) {
9
11
origin.mkdir()
10
- return ChildDirectoryStorageElement (origin, rootDirectory)
12
+ return @withContext ChildDirectoryStorageElement (origin, rootDirectory)
11
13
}
12
14
13
- override suspend fun createNewFile (): FileStorageElement {
15
+ override suspend fun createNewFile (): FileStorageElement = withContext( Dispatchers . IO ) {
14
16
origin.createNewFile()
15
- return FileStorageElement (origin, rootDirectory)
17
+ return @withContext FileStorageElement (origin, rootDirectory)
16
18
}
17
19
18
20
override val name: String
You can’t perform that action at this time.
0 commit comments