Browse Source

Clear dir also deletes

Sean Taylor 4 years ago
parent
commit
09df2610d0
1 changed files with 2 additions and 1 deletions
  1. 2 1
      build.py

+ 2 - 1
build.py

@@ -34,7 +34,8 @@ def clear_dir(dir_path):
         shutil.rmtree(dir_path, ignore_errors=True)
         shutil.rmtree(dir_path, ignore_errors=True)
     path = Path(dir_path)
     path = Path(dir_path)
     path.mkdir(parents=True)
     path.mkdir(parents=True)
-    os.rmdir(dir_path)
+    if os.path.exists(dir_path):
+        os.rmdir(dir_path)
 
 
 def copy_files(src_dir, dst_dir, match_exp):
 def copy_files(src_dir, dst_dir, match_exp):
     clear_dir(dst_dir)
     clear_dir(dst_dir)