diff --git a/src/commonMain/kotlin/teksturepako/pakku/Version.kt b/src/commonMain/kotlin/teksturepako/pakku/Version.kt index 4cbdd243..075a328f 100644 --- a/src/commonMain/kotlin/teksturepako/pakku/Version.kt +++ b/src/commonMain/kotlin/teksturepako/pakku/Version.kt @@ -2,4 +2,4 @@ package teksturepako.pakku -const val VERSION = "0.18.2" +const val VERSION = "0.19.0" diff --git a/src/commonMain/kotlin/teksturepako/pakku/api/actions/export/Export.kt b/src/commonMain/kotlin/teksturepako/pakku/api/actions/export/Export.kt index 58b9ff10..033ab42f 100644 --- a/src/commonMain/kotlin/teksturepako/pakku/api/actions/export/Export.kt +++ b/src/commonMain/kotlin/teksturepako/pakku/api/actions/export/Export.kt @@ -13,6 +13,7 @@ import teksturepako.pakku.api.data.Dirs.cacheDir import teksturepako.pakku.api.data.LockFile import teksturepako.pakku.api.data.workingPath import teksturepako.pakku.api.overrides.OverrideType +import teksturepako.pakku.api.overrides.filterOverrides import teksturepako.pakku.api.overrides.readProjectOverrides import teksturepako.pakku.api.platforms.Platform import teksturepako.pakku.debug diff --git a/src/commonMain/kotlin/teksturepako/pakku/api/data/ConfigFile.kt b/src/commonMain/kotlin/teksturepako/pakku/api/data/ConfigFile.kt index 146b9713..d4ee8133 100644 --- a/src/commonMain/kotlin/teksturepako/pakku/api/data/ConfigFile.kt +++ b/src/commonMain/kotlin/teksturepako/pakku/api/data/ConfigFile.kt @@ -8,10 +8,7 @@ import teksturepako.pakku.api.overrides.filterOverrides import teksturepako.pakku.api.projects.ProjectSide import teksturepako.pakku.api.projects.ProjectType import teksturepako.pakku.api.projects.UpdateStrategy -import teksturepako.pakku.io.decodeOrNew -import teksturepako.pakku.io.decodeToResult -import teksturepako.pakku.io.readPathTextOrNull -import teksturepako.pakku.io.writeToFile +import teksturepako.pakku.io.* /** * A config file (`pakku.json`) is a file used by the user to configure properties needed for modpack export. @@ -100,9 +97,9 @@ data class ConfigFile( this.overrides.clear() } - fun getAllOverrides(): List = filterOverrides(this.overrides) - fun getAllServerOverrides(): List = filterOverrides(this.serverOverrides) - fun getAllClientOverrides(): List = filterOverrides(this.clientOverrides) + fun getAllOverrides(): List = filterOverrides(this.overrides.expandWithGlob()) + fun getAllServerOverrides(): List = filterOverrides(this.serverOverrides.expandWithGlob()) + fun getAllClientOverrides(): List = filterOverrides(this.clientOverrides.expandWithGlob()) // -- PROJECTS -- diff --git a/src/commonMain/kotlin/teksturepako/pakku/io/Glob.kt b/src/commonMain/kotlin/teksturepako/pakku/io/Glob.kt new file mode 100644 index 00000000..151f5e74 --- /dev/null +++ b/src/commonMain/kotlin/teksturepako/pakku/io/Glob.kt @@ -0,0 +1,19 @@ +package teksturepako.pakku.io + +import java.nio.file.FileSystems +import java.nio.file.Path +import kotlin.io.path.ExperimentalPathApi +import kotlin.io.path.Path +import kotlin.io.path.PathWalkOption +import kotlin.io.path.walk + +@OptIn(ExperimentalPathApi::class) +fun Path.listDirectoryEntriesRecursive(glob: String): List +{ + val matcher = FileSystems.getDefault().getPathMatcher("glob:${glob.removePrefix("./")}") + return walk(PathWalkOption.INCLUDE_DIRECTORIES).filter { matcher.matches(it) }.toList() +} + +fun List.expandWithGlob() = flatMap { glob -> + Path("").listDirectoryEntriesRecursive(glob).map { it.toString() } +} \ No newline at end of file