Skip to content

Commit 99cac1f

Browse files
authored
Fix native build (#1636)
1 parent 035ef0a commit 99cac1f

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

pkl-core/src/main/java/org/pkl/core/stdlib/evaluatorsettings/EvaluatorSettingsNodes.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ private PathResolver getPathResolver(boolean forWindows) {
4343
return forWindows ? PathResolvers.forWindows() : PathResolvers.forPosix();
4444
}
4545

46+
@TruffleBoundary
4647
@Specialization
4748
protected String eval(VmTyped ignored, String uriStr, String path, boolean forWindows) {
4849
var uri = toUri(uriStr);

pkl-core/src/main/java/org/pkl/core/util/PathResolver.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616
package org.pkl.core.util;
1717

18+
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
1819
import java.net.URI;
1920
import java.util.ArrayList;
2021
import java.util.regex.Pattern;
@@ -82,13 +83,14 @@ protected String normalize(String path) {
8283
}
8384

8485
static final class WindowsPathResolver extends PathResolver {
86+
@TruffleBoundary
8587
@Override
8688
protected String uriToPath(URI uri) {
8789
var host = uri.getHost();
8890
var path = uri.getPath();
8991
if (host != null) {
9092
// UNC path: \\server\share\path
91-
return "\\\\%s%s".formatted(host, path.replace('/', '\\'));
93+
return "\\\\" + host + path.replace('/', '\\');
9294
}
9395
var ret = path.matches("/[A-Z]:/.*") ? path.substring(1) : path;
9496
return ret.replace('/', '\\');
@@ -164,6 +166,7 @@ protected String normalize(String path) {
164166
}
165167

166168
static final class PosixPathResolver extends PathResolver {
169+
@TruffleBoundary
167170
@Override
168171
protected String uriToPath(URI uri) {
169172
return uri.getPath();

0 commit comments

Comments
 (0)