mirror of
https://github.com/GayPizzaSpecifications/pork.git
synced 2025-08-03 05:10:55 +00:00
tool: use absolute path for root
This commit is contained in:
parent
e7f36e0524
commit
2f0ee43556
@ -5,10 +5,11 @@ import gay.pizza.pork.frontend.FsContentSource
|
|||||||
import gay.pizza.pork.parser.CharSource
|
import gay.pizza.pork.parser.CharSource
|
||||||
import gay.pizza.pork.parser.StringCharSource
|
import gay.pizza.pork.parser.StringCharSource
|
||||||
import java.nio.file.Path
|
import java.nio.file.Path
|
||||||
|
import kotlin.io.path.absolute
|
||||||
import kotlin.io.path.readText
|
import kotlin.io.path.readText
|
||||||
|
|
||||||
class FileTool(val path: Path) : Tool() {
|
class FileTool(val path: Path) : Tool() {
|
||||||
override fun createCharSource(): CharSource = StringCharSource(path.readText())
|
override fun createCharSource(): CharSource = StringCharSource(path.readText())
|
||||||
override fun createContentSource(): ContentSource = FsContentSource(path.parent)
|
override fun createContentSource(): ContentSource = FsContentSource(path.absolute().parent)
|
||||||
override fun rootFilePath(): String = path.fileName.toString()
|
override fun rootFilePath(): String = path.fileName.toString()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user