diff --git a/src/main/kotlin/app/revanced/patcher/patch/PatchOption.kt b/src/main/kotlin/app/revanced/patcher/patch/PatchOption.kt index 95defbd..7774ec2 100644 --- a/src/main/kotlin/app/revanced/patcher/patch/PatchOption.kt +++ b/src/main/kotlin/app/revanced/patcher/patch/PatchOption.kt @@ -2,6 +2,7 @@ package app.revanced.patcher.patch +import java.io.File import java.nio.file.Path import kotlin.reflect.KProperty @@ -195,14 +196,31 @@ sealed class PatchOption( * A [PatchOption] representing a [Path]. * @see PatchOption */ - class PathOption( + sealed class PathOption( key: String, - default: T?, + default: Path?, title: String, description: String, required: Boolean = false, - validator: (T?) -> Boolean = { true } - ) : PatchOption( + validator: (Path?) -> Boolean = { true } + ) : PatchOption( key, default, title, description, required, validator ) + + /** + * A [PathOption] of type [File]. + * @see PathOption + */ + class FileOption( + key: String, + default: File?, + title: String, + description: String, + required: Boolean = false, + validator: (File?) -> Boolean = { true } + ) : PathOption( + key, default?.toPath(), title, description, required, { + validator(it?.toFile()) + } + ) } \ No newline at end of file