Skip to content

Commit 2e9694b

Browse files
committed
Allow folders to be extra student files
1 parent f48f7bc commit 2e9694b

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

tmc-langs-framework/src/main/java/fi/helsinki/cs/tmc/langs/io/ConfigurableStudentFilePolicy.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,18 @@ public boolean isStudentFile(Path path, Path projectRootPath) {
6969
projectRootPath);
7070
}
7171

72-
/**
73-
* Determines whether a file is an <tt>ExtraStudentFile</tt>.
74-
*/
72+
/** Determines whether a file is an <tt>ExtraStudentFile</tt>. */
7573
private boolean isExtraStudentFile(Path path) {
7674
if (extraStudentFiles == null) {
7775
loadExtraStudentFileList();
7876
}
7977

8078
for (Path extraStudentFile : extraStudentFiles) {
81-
if (rootPath.resolve(extraStudentFile).toAbsolutePath().equals(path.toAbsolutePath())) {
79+
Path extraStudentPath = rootPath.resolve(extraStudentFile).toAbsolutePath();
80+
Path userSuppliedPath = path.toAbsolutePath();
81+
if (extraStudentPath.equals(userSuppliedPath)
82+
|| (userSuppliedPath.startsWith((extraStudentPath))
83+
&& Files.isDirectory(extraStudentPath))) {
8284
return true;
8385
}
8486
}

0 commit comments

Comments
 (0)