Skip to content

Commit f68d455

Browse files
committed
fix: snippet to use project.dir
Close. #19
1 parent 74d3fe1 commit f68d455

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

docs-asciidoc-extensions/src/main/groovy/io/micronaut/docs/LanguageSnippetMacro.groovy

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,11 @@ class LanguageSnippetMacro extends BlockMacroProcessor implements ValueAtAttribu
6666
List includes = []
6767
for (fileName in files) {
6868
String baseName = fileName.replace(".", File.separator)
69-
File file = new File("$projectDir/src/$sourceType/$sourceFolder/${baseName}.$ext")
69+
String pathName = "$projectDir/src/$sourceType/$sourceFolder/${baseName}.$ext"
70+
if (System.getProperty("user.dir") != null) {
71+
pathName = "${System.getProperty("user.dir")}${File.separator}${pathName}".toString()
72+
}
73+
File file = new File(pathName)
7074
if (!file.exists()) {
7175
println "!!!! WARNING: NO FILE FOUND MATCHING TARGET PASSED IN AT PATH : $file.path"
7276
continue

0 commit comments

Comments
 (0)