Fix usage of file() notation with Pkl Gradle plugin on Windows (#611)

This is a port of a fix that was included in https://github.com/apple/pkl/pull/403.
This commit is contained in:
Daniel Chao
2024-08-06 07:54:52 -07:00
committed by GitHub
parent d097341abd
commit f9a3fc88fd

View File

@@ -134,6 +134,9 @@ public abstract class ModulesTask extends BasePklTask {
*/
private URI parsedModuleNotationToUri(Object notation) {
if (notation instanceof File file) {
if (file.isAbsolute()) {
return file.toPath().toUri();
}
return IoUtils.createUri(IoUtils.toNormalizedPathString(file.toPath()));
} else if (notation instanceof URI uri) {
return uri;