Skip to content

Latest commit

 

History

History
31 lines (22 loc) · 1.75 KB

from-if-present.md

File metadata and controls

31 lines (22 loc) · 1.75 KB

subkt / myaa.subkt.tasks / Merge / fromIfPresent

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)

Parameters

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.