Skip to content

Commit

Permalink
URI -> Uri
Browse files Browse the repository at this point in the history
  • Loading branch information
HT154 committed Oct 20, 2024
1 parent f8605ec commit 1939042
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public static StackFrameTransformer convertFilePathToUriScheme(String scheme) {
var uri = frame.getModuleUri();
if (!uri.startsWith("file:")) return frame;

return transformUri(frame, IoUtils.pathOfURI(URI.create(uri)).toString(), scheme);
return transformUri(frame, IoUtils.pathOfUri(URI.create(uri)).toString(), scheme);
};
}

Expand Down
4 changes: 2 additions & 2 deletions pkl-core/src/main/java/org/pkl/core/module/FileResolver.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public final class FileResolver {
private FileResolver() {}

public static List<PathElement> listElements(URI baseUri) throws IOException {
return listElements(IoUtils.pathOfURI(baseUri));
return listElements(IoUtils.pathOfUri(baseUri));
}

public static List<PathElement> listElements(Path path) throws IOException {
Expand All @@ -50,7 +50,7 @@ public static List<PathElement> listElements(Path path) throws IOException {
}

public static boolean hasElement(URI elementUri) {
return Files.exists(IoUtils.pathOfURI(elementUri));
return Files.exists(IoUtils.pathOfUri(elementUri));
}

public static boolean hasElement(Path path) {
Expand Down
3 changes: 1 addition & 2 deletions pkl-core/src/main/java/org/pkl/core/module/ModuleKeys.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
package org.pkl.core.module;

import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
Expand Down Expand Up @@ -324,7 +323,7 @@ public ResolvedModuleKey resolve(SecurityManager securityManager)
if (java.io.File.separatorChar == '\\' && uriPath != null && uriPath.contains("\\")) {
throw new FileNotFoundException();
}
var realPath = IoUtils.pathOfURI(uri).toRealPath();
var realPath = IoUtils.pathOfUri(uri).toRealPath();
var resolvedUri = realPath.toUri();
securityManager.checkResolveModule(resolvedUri);
return ResolvedModuleKeys.file(this, resolvedUri, realPath);
Expand Down
2 changes: 1 addition & 1 deletion pkl-core/src/main/java/org/pkl/core/util/IoUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public static URI toUri(String str) throws URISyntaxException {
}

/** Converts a URI to a Path, normalizing any non-ASCII characters. */
public static Path pathOfURI(URI uri) {
public static Path pathOfUri(URI uri) {
// Path.of(URI) throws on non-ASCII characters so the module URI here must be normalized to
// ASCII
// Unfortunately there's no way to go from URI -> ASCII URI directly
Expand Down

0 comments on commit 1939042

Please sign in to comment.