]> git.phdru.name Git - phdru.name/phdru.name.git/blobdiff - dotfiles2html/dotfiles2html.py
Fixed a bug: do not compare if the template does not exist yet.
[phdru.name/phdru.name.git] / dotfiles2html / dotfiles2html.py
index 8952fe862931ed14f0aeff1672eb3ecfe5444e8d..504261969124c84d61c6afa1304362d990198443 100755 (executable)
@@ -69,8 +69,8 @@ for i, (fname, ftype) in enumerate(file_types):
       else:
          next = file_types[i+1][0]
       add_headers(fname, prev, next)
-      if not filecmp.cmp(fname + ".html", fname + ".tmpl"):
-         os.rename(fname + ".html", fname + ".tmpl")
-      else:
+      if os.path.exists(fname + ".tmpl") and filecmp.cmp(fname + ".html", fname + ".tmpl"):
          os.remove(fname + ".html")
+      else:
+         os.rename(fname + ".html", fname + ".tmpl")
       os.chmod(fname, 0644)