Ensure absolute paths in NodeJS and JVM.

This commit is contained in:
2023-09-05 16:17:48 -07:00
parent ead67199fd
commit 3056aa9dfc
3 changed files with 9 additions and 8 deletions

View File

@ -2,7 +2,9 @@ package gay.pizza.dough.fs
import gay.pizza.dough.fs.nodefs.NodePathModule
class NodePath(override val fullPathString: String) : FsPath {
class NodePath(fullPathString: String) : FsPath {
override val fullPathString: String = NodePathModule.resolve(fullPathString)
override val entityNameString: String
get() = NodePathModule.baseName(fullPathString)
override val parent: FsPath

View File

@ -1,13 +1,10 @@
package gay.pizza.dough.fs
import gay.pizza.dough.fs.nodefs.NodePathModule
object NodejsFsProvider : FsProvider {
override val currentWorkingDirectory: FsPath
get() = NodePath(NodePathModule.resolve("."))
get() = NodePath(".")
override val operations: FsOperations
get() = TODO()
override val operations: FsOperations = NodeFsOperations
override fun resolve(path: String): FsPath = NodePath(NodePathModule.resolve(path))
override fun resolve(path: String): FsPath = NodePath(path)
}

View File

@ -4,7 +4,9 @@ import java.nio.file.Path
import java.util.*
import kotlin.io.path.relativeTo
class JavaPath(val javaPath: Path) : FsPath {
class JavaPath(path: Path) : FsPath {
val javaPath: Path = path.toAbsolutePath()
override val fullPathString: String
get() = javaPath.toString()