MPPFile#withoutSlashAtTheEnd

This commit is contained in:
InsanusMokrassar committed 2021-09-08 12:06:23 +06:00
1 parent d50dffec8c
commit 925702d315
2 files changed
+5 -1

No files matched your search

@@ -7,7 +7,7 @@ import kotlin.jvm.JvmInline
@JvmInline
value class FileName(val string: String) {
val name: String
get() = string.takeLastWhile { it != '/' }
get() = withoutSlashAtTheEnd.takeLastWhile { it != '/' }
val extension: String
get() = name.takeLastWhile { it != '.' }
val nameWithoutExtension: String
@@ -17,6 +17,8 @@ value class FileName(val string: String) {
filename.substring(0, it)
} ?: filename
}
val withoutSlashAtTheEnd: String
get() = string.dropLastWhile { it == '/' }
override fun toString(): String = string
}