File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
shared/src/main/kotlin/org/javacs/kt/storage Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import kotlinx.serialization.json.Json
10
10
import kotlinx.serialization.serializer
11
11
import org.javacs.kt.LOG
12
12
import java.lang.Exception
13
+ import java.nio.file.FileAlreadyExistsException
13
14
import java.nio.file.Files
14
15
import java.nio.file.Path
15
16
import java.nio.file.Paths
@@ -18,9 +19,9 @@ class Storage(val path: Path) {
18
19
fun getSlice (slicePath : String ): Storage ? {
19
20
val fullSlicePath = Paths .get(path.toString(), slicePath)
20
21
21
- if ( ! Files .exists(fullSlicePath)) {
22
- Files .createDirectory (fullSlicePath)
23
- } else if ( ! Files .isDirectory(fullSlicePath) ) {
22
+ try {
23
+ Files .createDirectories (fullSlicePath)
24
+ } catch (ex : FileAlreadyExistsException ) {
24
25
return null
25
26
}
26
27
You can’t perform that action at this time.
0 commit comments