fix bug where we forget to change back to the original directory after zipping logs, thus preventing control panel from opening.

nanotube [2007-01-10 06:57]
fix bug where we forget to change back to the original directory after zipping logs, thus preventing control panel from opening.
Filename
logwriter.py
diff --git a/logwriter.py b/logwriter.py
index cedb914..4249fd4 100644
--- a/logwriter.py
+++ b/logwriter.py
@@ -181,7 +181,9 @@ class LogWriter:
         zipFileTime = time.strftime("%Y%m%d_%H%M%S")
         zipFileRawTime = time.time()
         zipFileName = re.sub(r"\[date\]", zipFileTime, zipFilePattern)
-
+
+        # have to change to the dir so we dont get extra dir hierarchy in the zipfile
+        originalDir = os.getcwd()
         os.chdir(self.settings['General']['Log Directory'])
         myzip = zipfile.ZipFile(zipFileName, "w", zipfile.ZIP_DEFLATED)

@@ -204,6 +206,9 @@ class LogWriter:
         ziplog.write(zipFileName)
         ziplog.close()

+        # chdir back
+        os.chdir(originalDir)
+
         #now we can delete all the logs that have not been modified since we made the zip.
         self.DeleteOldLogs(zipFileRawTime)
ViewGit