File tree Expand file tree Collapse file tree
main/kotlin/com/mineinabyss/keepup/config_sync
should-copy-individual-files
should-correctly-default-dest/plugins/example
should-correctly-set-dest
expected-output/plugins/example Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11kotlin.code.style =official
22group =com.mineinabyss
3- version =3.2.0-alpha.1
3+ version =3.2.0-alpha.2
44idofrontVersion =0.25.6
Original file line number Diff line number Diff line change 11package com.mineinabyss.keepup.config_sync
22
3+ import com.mineinabyss.keepup.helpers.MSG
4+ import com.mineinabyss.keepup.t
35import java.nio.file.FileVisitResult
46import java.nio.file.Path
57import kotlin.io.path.*
@@ -14,12 +16,20 @@ class ConfigTreeBuilder {
1416 roots.forEach { copyPath ->
1517 val sourceRoot = configsRoot / copyPath.source
1618 val destOffset = Path (copyPath.dest)
17- sourceRoot.walk( PathWalkOption . INCLUDE_DIRECTORIES )
18- .filter { it. isRegularFile() }
19- .forEach { source ->
20- val dest = destOffset / source.relativeTo( sourceRoot)
21- destToSource[dest] = source
19+ when {
20+ sourceRoot. isRegularFile() -> {
21+ val dest = destOffset / sourceRoot.fileName
22+ destToSource[ dest] = sourceRoot
23+ return @forEach
2224 }
25+ sourceRoot.isDirectory() -> sourceRoot.walk(PathWalkOption .INCLUDE_DIRECTORIES )
26+ .filter { it.isRegularFile() }
27+ .forEach { source ->
28+ val dest = destOffset / source.relativeTo(sourceRoot)
29+ destToSource[dest] = source
30+ }
31+ else -> t.println (" ${MSG .warn} Included path $sourceRoot does not exist." )
32+ }
2333 }
2434 return destToSource
2535 }
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change 11feat/example :
22 copyPaths :
3- - source : plugins/example
3+ - source : should-correctly-set-dest
4+ dest : plugins/example
5+ - should-correctly-default-dest
6+ - source : should-copy-individual-files/copy-individual
47 dest : plugins/example
5- - feat/example
68
79example-host :
810 include :
You can’t perform that action at this time.
0 commit comments