Commits

Andrey Vlasovskikh committed c156d69

Delete obsolete files inside _site, not only directories

Comments (0)

Files changed (1)

             pass
 
 
-def rmtree(path):
+def remove(path):
     try:
-        shutil.rmtree(path)
+        if os.path.isdir(path):
+            shutil.rmtree(path)
+        else:
+            os.remove(path)
     except OSError as e:
         if e.errno == errno.EEXIST:
             pass
     destdir = os.path.join(basedir, '_site')
     makedirs(destdir)
     for name in os.listdir(destdir):
-        rmtree(os.path.join(destdir, name))
+        remove(os.path.join(destdir, name))
     for processor in processors:
         log('{0}...'.format(object_name(processor)))
         processor(basedir, destdir, site)