EDU-642 Local course doesn't replace its old version
authorLiana Bakradze <liana.bakradze@jetbrains.com>
Wed, 3 Aug 2016 10:53:14 +0000 (13:53 +0300)
committerLiana Bakradze <liana.bakradze@jetbrains.com>
Wed, 3 Aug 2016 10:59:35 +0000 (13:59 +0300)
python/educational-core/student/src/com/jetbrains/edu/learning/courseGeneration/StudyProjectGenerator.java

index 0d2245936a940c9c3faaec831b0ca4ef82d3329b..02249eab36883c103d2b1fea0f0e71ff660c6282 100644 (file)
@@ -478,7 +478,11 @@ public class StudyProjectGenerator {
       flushCache(myCourses);
       if (courseName != null && !courseName.getName().equals(unzippedName)) {
         //noinspection ResultOfMethodCallIgnored
-        courseDir.renameTo(new File(OUR_COURSES_DIR, courseName.getName()));
+        File dest = new File(OUR_COURSES_DIR, courseName.getName());
+        if (dest.exists()) {
+          FileUtil.delete(dest);
+        }
+        courseDir.renameTo(dest);
         //noinspection ResultOfMethodCallIgnored
         courseDir.delete();
       }