mirror of
https://github.com/apple/pkl.git
synced 2026-06-04 13:00:40 +02:00
Fix native build (#1636)
This commit is contained in:
+1
@@ -43,6 +43,7 @@ public class EvaluatorSettingsNodes {
|
||||
return forWindows ? PathResolvers.forWindows() : PathResolvers.forPosix();
|
||||
}
|
||||
|
||||
@TruffleBoundary
|
||||
@Specialization
|
||||
protected String eval(VmTyped ignored, String uriStr, String path, boolean forWindows) {
|
||||
var uri = toUri(uriStr);
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package org.pkl.core.util;
|
||||
|
||||
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
|
||||
import java.net.URI;
|
||||
import java.util.ArrayList;
|
||||
import java.util.regex.Pattern;
|
||||
@@ -82,13 +83,14 @@ public abstract sealed class PathResolver {
|
||||
}
|
||||
|
||||
static final class WindowsPathResolver extends PathResolver {
|
||||
@TruffleBoundary
|
||||
@Override
|
||||
protected String uriToPath(URI uri) {
|
||||
var host = uri.getHost();
|
||||
var path = uri.getPath();
|
||||
if (host != null) {
|
||||
// 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;
|
||||
return ret.replace('/', '\\');
|
||||
@@ -164,6 +166,7 @@ public abstract sealed class PathResolver {
|
||||
}
|
||||
|
||||
static final class PosixPathResolver extends PathResolver {
|
||||
@TruffleBoundary
|
||||
@Override
|
||||
protected String uriToPath(URI uri) {
|
||||
return uri.getPath();
|
||||
|
||||
Reference in New Issue
Block a user