mirror of
https://github.com/apple/pkl.git
synced 2026-07-11 23:52:39 +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();
|
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();
|
||||||
|
|||||||
Reference in New Issue
Block a user