Fix native build (#1636)

This commit is contained in:
Daniel Chao
2026-06-02 15:57:52 -07:00
committed by GitHub
parent 035ef0a789
commit 99cac1f886
2 changed files with 5 additions and 1 deletions
@@ -43,6 +43,7 @@ public class EvaluatorSettingsNodes {
return forWindows ? PathResolvers.forWindows() : PathResolvers.forPosix(); return forWindows ? PathResolvers.forWindows() : PathResolvers.forPosix();
} }
@TruffleBoundary
@Specialization @Specialization
protected String eval(VmTyped ignored, String uriStr, String path, boolean forWindows) { protected String eval(VmTyped ignored, String uriStr, String path, boolean forWindows) {
var uri = toUri(uriStr); var uri = toUri(uriStr);
@@ -15,6 +15,7 @@
*/ */
package org.pkl.core.util; package org.pkl.core.util;
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
import java.net.URI; import java.net.URI;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@@ -82,13 +83,14 @@ public abstract sealed class PathResolver {
} }
static final class WindowsPathResolver extends PathResolver { static final class WindowsPathResolver extends PathResolver {
@TruffleBoundary
@Override @Override
protected String uriToPath(URI uri) { protected String uriToPath(URI uri) {
var host = uri.getHost(); var host = uri.getHost();
var path = uri.getPath(); var path = uri.getPath();
if (host != null) { if (host != null) {
// UNC path: \\server\share\path // UNC path: \\server\share\path
return "\\\\%s%s".formatted(host, path.replace('/', '\\')); return "\\\\" + host + path.replace('/', '\\');
} }
var ret = path.matches("/[A-Z]:/.*") ? path.substring(1) : path; var ret = path.matches("/[A-Z]:/.*") ? path.substring(1) : path;
return ret.replace('/', '\\'); return ret.replace('/', '\\');
@@ -164,6 +166,7 @@ public abstract sealed class PathResolver {
} }
static final class PosixPathResolver extends PathResolver { static final class PosixPathResolver extends PathResolver {
@TruffleBoundary
@Override @Override
protected String uriToPath(URI uri) { protected String uriToPath(URI uri) {
return uri.getPath(); return uri.getPath();