Skip to content
This repository has been archived by the owner on Feb 26, 2023. It is now read-only.

Commit

Permalink
Merge pull request #2269 from WonderCsabo/2267-windows-manifest-finder
Browse files Browse the repository at this point in the history
Fix finding project folder on Windows
  • Loading branch information
dodgex committed Apr 10, 2020
2 parents 40f20f9 + e3ad4b7 commit d6048e1
Showing 1 changed file with 7 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,11 @@ public static FileHolder findRootProjectHolder(ProcessingEnvironment processingE
} catch (IOException ignored) {
throw new FileNotFoundException();
}
String dummySourceFilePath = dummySourceFile.toUri().toString();

return createFileHolder(dummySourceFile.toUri().toString());
}

private static FileHolder createFileHolder(String dummySourceFilePath) throws FileNotFoundException {
if (dummySourceFilePath.startsWith("file:")) {
if (!dummySourceFilePath.startsWith("file:https://")) {
dummySourceFilePath = "file:https://" + dummySourceFilePath.substring("file:".length());
Expand Down Expand Up @@ -89,19 +92,10 @@ private static FileHolder findKaptRootProjectHolder(ProcessingEnvironment proces
return null;
}

File kaptFolder = new File(kaptFolderOption.replace("kaptKotlin", "kapt"));
File dummySourceFile = new File(kaptFolder, "dummy");
String dummySourceFile = kaptFolderOption.replace("kaptKotlin", "kapt") + File.separator + "dummy";
String dummySourceFilePath = new File(dummySourceFile).toURI().toString();

String dummySourceFilePath;
try {
dummySourceFilePath = new URI("file:https://" + dummySourceFile.getAbsolutePath()).toString();
} catch (URISyntaxException e) {
throw new FileNotFoundException();
}

File sourcesGenerationFolder = kaptFolder;
File projectRoot = kaptFolder.getParentFile();
return new FileHolder(dummySourceFilePath, sourcesGenerationFolder, projectRoot);
return createFileHolder(dummySourceFilePath);
}

public static File resolveOutputDirectory(ProcessingEnvironment processingEnv) throws FileNotFoundException {
Expand Down

0 comments on commit d6048e1

Please sign in to comment.