From 4b0bbf5190f569cb060b8fb0a48e35dd7dddddf8 Mon Sep 17 00:00:00 2001 From: TopchetoEU <36534413+TopchetoEU@users.noreply.github.com> Date: Sun, 24 Dec 2023 14:40:27 +0200 Subject: [PATCH] fix: correctly convert virtual to real path --- src/me/topchetoeu/jscript/filesystem/PhysicalFilesystem.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/me/topchetoeu/jscript/filesystem/PhysicalFilesystem.java b/src/me/topchetoeu/jscript/filesystem/PhysicalFilesystem.java index 80bcf2f..18bdb39 100644 --- a/src/me/topchetoeu/jscript/filesystem/PhysicalFilesystem.java +++ b/src/me/topchetoeu/jscript/filesystem/PhysicalFilesystem.java @@ -10,7 +10,9 @@ public class PhysicalFilesystem implements Filesystem { public final Path root; private Path getPath(String name) { - return root.resolve(name.replace("\\", "/")).normalize(); + var absolutized = Path.of("/" + name.replace("\\", "/")).normalize().toString(); + var res = Path.of(root.toString() + absolutized).normalize(); + return res; } private void checkMode(Path path, Mode mode) {