mirror of
				https://github.com/GayPizzaSpecifications/pork.git
				synced 2025-11-03 17:39:38 +00:00 
			
		
		
		
	tool: use absolute path for root
This commit is contained in:
		@ -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()
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user