Commit 61f15d61 authored by Joel Collins's avatar Joel Collins
Browse files

Restructured how temporary paths are calculated

parent 24ded8de
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -215,6 +215,12 @@ class CaptureObject(object):
        """
        global TEMP_CAPTURE_PATH

        if self.temporary:
            # Store original file path
            self.file_notmp = os.path.join(folder, filename) 
            # Move user-specified folder to TEMP
            self.folder = os.path.join(TEMP_CAPTURE_PATH, self.folder)

        self.file = os.path.join(folder, filename)  # Full file name by joining given folder to given name

        self.split_file_path(self.file)  # Split file path into folder, filename, and basename
@@ -223,12 +229,6 @@ class CaptureObject(object):
        if not os.path.commonprefix([self.file, BASE_CAPTURE_PATH]) == BASE_CAPTURE_PATH:
            raise Exception("Captures cannot be stored in a lower-level directory than {}.".format(BASE_CAPTURE_PATH))

        # Move to tmp directory if not being kept
        if self.temporary:
            self.file_notmp = self.file  # Store originally defined folder
            self.filefolder = TEMP_CAPTURE_PATH
            self.file = os.path.join(self.filefolder, self.filename)

        # Create folder and file
        if not os.path.exists(self.filefolder):
            os.makedirs(self.filefolder)