0.1.1-SNAPSHOT: storages, sync tools, docs
This commit is contained in:
1 parent
3e6c487601
commit
babc3933eb
24 files changed
+925
-52
No files matched your search
@@ -0,0 +1,21 @@
|
||||
package net.sergeych.bintools
|
||||
|
||||
import java.nio.file.Paths
|
||||
import kotlin.io.path.createDirectories
|
||||
|
||||
actual fun defaultNamedStorage(name: String): KVStorage {
|
||||
val rootFolder = Paths.get(when {
|
||||
// absolute path
|
||||
name.startsWith("/") -> name
|
||||
// path - assume the caller knows what to do
|
||||
name.contains("/") -> name
|
||||
// simple name - we will create it in the user home:
|
||||
else -> {
|
||||
val home = System.getProperty("user.home")
|
||||
"$home/.local_storage/$name"
|
||||
}
|
||||
})
|
||||
rootFolder.createDirectories()
|
||||
val provider = FileDataProvider(rootFolder)
|
||||
return DataKVStorage(provider)
|
||||
}
|
||||
Reference in new issue
Block a user