support src folder in archive
[idea/community.git] / 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) {