subkt / myaa.subkt.tasks / Merge / fromIfPresent
fun fromIfPresent(vararg files:
Any
, ignoreMissingFiles:
Boolean
= false, action:
Merge.MergeSpecification
.() ->
Unit
= {}):
Unit
(source)
Adds files to merge, unless the given provider (property) isn't defined.
Will still result in an error if the property is defined
but the file it points to is missing on the file system,
unless [ignoreMissingFiles](from-if-present.md#myaa.subkt.tasks.Merge$fromIfPresent(kotlin.Array((kotlin.Any)), kotlin.Boolean, kotlin.Function1((myaa.subkt.tasks.Merge.MergeSpecification, kotlin.Unit)))/ignoreMissingFiles) is true
.
// property file: {01,03}.OP=OP_${episode}.ass
// silently ignores the input for episodes other than 01 and 03
// (for which the property isn't defined); fails for episodes
// 01 and 03 if e.g. OP_01.ass doesn't exist.
fromIfPresent(get("OP"))
// doesn't fail even if e.g. OP_01.ass doesn't exist.
fromIfPresent(get("OP"), ignoreMissingFiles = true)
files
- The files to merge.
ignoreMissingFiles
- Whether to silently ignore files missing
from the file system.
action
- A closure operating on a MergeSpecification instance
for customizing how the given files should be merged.