support src folder in archive
authorLiana.Bakradze <liana.bakradze@jetbrains.com>
Tue, 25 Oct 2016 16:30:46 +0000 (19:30 +0300)
committerliana.bakradze <liana.bakradze@jetbrains.com>
Thu, 17 Nov 2016 14:08:31 +0000 (17:08 +0300)
python/educational-core/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCCreateCourseArchive.java

index 45f8d8ba8b8110be4f3027ca64e76856fe358c21..64182506bcbb24655ffda92b5a995245da661ebb 100644 (file)
@@ -116,12 +116,17 @@ public class CCCreateCourseArchive extends DumbAwareAction {
           final VirtualFile lessonDir = baseDir.findChild(EduNames.LESSON + String.valueOf(lesson.getIndex()));
           if (lessonDir == null) continue;
           for (Task task : lesson.getTaskList()) {
-            final VirtualFile taskDir = lessonDir.findChild(EduNames.TASK + String.valueOf(task.getIndex()));
+            final VirtualFile taskDir = task.getTaskDir(project);
             if (taskDir == null) continue;
-            VirtualFile studentFileDir = VfsUtil.findRelativeFile(archiveFolder, lessonDir.getName(), taskDir.getName());
+            String taskDirName = EduNames.TASK + String.valueOf(task.getIndex());
+            VirtualFile studentFileDir = VfsUtil.findRelativeFile(archiveFolder, lessonDir.getName(), taskDirName);
             if (studentFileDir == null) {
               continue;
             }
+            VirtualFile srcDir = studentFileDir.findChild(EduNames.SRC);
+            if (srcDir != null) {
+              studentFileDir = srcDir;
+            }
             for (String taskFile : task.getTaskFiles().keySet()) {
               VirtualFile answerFile = taskDir.findChild(taskFile);
               if (answerFile == null) {