Skip to content

Commit 801773d

Browse files
author
Cedric Betom
committed
devonfw#1509 Adapted testAdaptMonolithicTemplatesAndGenerate to make the download works
1 parent 79296a0 commit 801773d

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

cobigen-eclipse/cobigen-eclipse-test/src/main/java/com/devonfw/cobigen/eclipse/test/AdaptTemplatesTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ public void testBasicOpenAPIGenerationWithAdaptMonolithicTemplates() throws Exce
182182
@Test
183183
public void testAdaptMonolithicTemplatesAndGenerate() throws Exception {
184184

185-
File tmpProject = this.tempFolder.newFolder("playground", "project");
185+
File tmpProject = this.tempFolder.newFolder("playground", "project", "templates");
186186
withEnvironmentVariable("COBIGEN_HOME", tmpProject.toPath().toString())
187187
.execute(() -> testBasicOpenAPIGenerationWithAdaptMonolithicTemplates());
188188
}

cobigen/cobigen-core-api/src/main/java/com/devonfw/cobigen/api/util/CobiGenPaths.java

+10-2
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,16 @@ public static Path getTemplatesFolderPath() {
7474
*/
7575
public static Path getTemplatesFolderPath(Path home) {
7676

77-
Path templatesPath = home.resolve(ConfigurationConstants.TEMPLATES_FOLDER);
78-
return templatesPath;
77+
File file = new File(home.toString());
78+
int lastSlash = file.getName().lastIndexOf("/");
79+
String lastWord = file.getName().substring(lastSlash + 1);
80+
if (lastWord.equals(ConfigurationConstants.TEMPLATES_FOLDER)) {
81+
return home;
82+
} else {
83+
home = home.resolve(ConfigurationConstants.TEMPLATES_FOLDER);
84+
}
85+
86+
return home;
7987
}
8088

8189
/**

0 commit comments

Comments
 (0)