Skip to content

Commit 0ba57ff

Browse files
committed
Recognize extra student files from subdirectories
1 parent 2e9694b commit 0ba57ff

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

tmc-langs-framework/src/main/java/fi/helsinki/cs/tmc/langs/utils/TmcProjectYmlParser.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,21 @@ private void addAllIfList(Object files) {
107107

108108
private void addIfString(Object value) {
109109
if (value instanceof String) {
110-
Path path = Paths.get((String) value);
110+
String[] pathParts = ((String) value).split("/");
111+
Path path = constructPathfromArray(pathParts);
111112
extraStudentFiles.add(path);
112113
log.trace("Added {} as extra student file", path);
113114
}
114115
}
115116

117+
private Path constructPathfromArray(String[] parts) {
118+
Path path = Paths.get(parts[0]);
119+
for (int i = 1; i < parts.length; i++) {
120+
path = path.resolve(parts[i]);
121+
}
122+
return path;
123+
}
124+
116125
private String initFileContents(File file) {
117126
try {
118127
log.trace("Reading config file");

0 commit comments

Comments
 (0)