Skip to content

Commit d6048e1

Browse files
authored
Merge pull request androidannotations#2269 from WonderCsabo/2267-windows-manifest-finder
Fix finding project folder on Windows
2 parents 40f20f9 + e3ad4b7 commit d6048e1

1 file changed

Lines changed: 7 additions & 13 deletions

File tree

  • AndroidAnnotations/androidannotations-core/androidannotations/src/main/java/org/androidannotations/internal/helper

AndroidAnnotations/androidannotations-core/androidannotations/src/main/java/org/androidannotations/internal/helper/FileHelper.java

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,11 @@ public static FileHolder findRootProjectHolder(ProcessingEnvironment processingE
5858
} catch (IOException ignored) {
5959
throw new FileNotFoundException();
6060
}
61-
String dummySourceFilePath = dummySourceFile.toUri().toString();
6261

62+
return createFileHolder(dummySourceFile.toUri().toString());
63+
}
64+
65+
private static FileHolder createFileHolder(String dummySourceFilePath) throws FileNotFoundException {
6366
if (dummySourceFilePath.startsWith("file:")) {
6467
if (!dummySourceFilePath.startsWith("file://")) {
6568
dummySourceFilePath = "file://" + dummySourceFilePath.substring("file:".length());
@@ -89,19 +92,10 @@ private static FileHolder findKaptRootProjectHolder(ProcessingEnvironment proces
8992
return null;
9093
}
9194

92-
File kaptFolder = new File(kaptFolderOption.replace("kaptKotlin", "kapt"));
93-
File dummySourceFile = new File(kaptFolder, "dummy");
95+
String dummySourceFile = kaptFolderOption.replace("kaptKotlin", "kapt") + File.separator + "dummy";
96+
String dummySourceFilePath = new File(dummySourceFile).toURI().toString();
9497

95-
String dummySourceFilePath;
96-
try {
97-
dummySourceFilePath = new URI("file://" + dummySourceFile.getAbsolutePath()).toString();
98-
} catch (URISyntaxException e) {
99-
throw new FileNotFoundException();
100-
}
101-
102-
File sourcesGenerationFolder = kaptFolder;
103-
File projectRoot = kaptFolder.getParentFile();
104-
return new FileHolder(dummySourceFilePath, sourcesGenerationFolder, projectRoot);
98+
return createFileHolder(dummySourceFilePath);
10599
}
106100

107101
public static File resolveOutputDirectory(ProcessingEnvironment processingEnv) throws FileNotFoundException {

0 commit comments

Comments
 (0)