summaryrefslogtreecommitdiff
path: root/MAT/parser.py
diff options
context:
space:
mode:
Diffstat (limited to 'MAT/parser.py')
-rw-r--r--MAT/parser.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/MAT/parser.py b/MAT/parser.py
index 2dda074..e956164 100644
--- a/MAT/parser.py
+++ b/MAT/parser.py
@@ -7,6 +7,7 @@ import hachoir_editor
7 7
8import os 8import os
9import tempfile 9import tempfile
10import shutil
10 11
11import mat 12import mat
12 13
@@ -38,6 +39,12 @@ class GenericParser(object):
38 _, output = tempfile.mkstemp() 39 _, output = tempfile.mkstemp()
39 self.output = hachoir_core.cmd_line.unicodeFilename(output) 40 self.output = hachoir_core.cmd_line.unicodeFilename(output)
40 41
42 def __del__(self):
43 ''' Remove tempfile if it was not used
44 '''
45 if os.path.exists(self.output):
46 mat.secure_remove(self.output)
47
41 def is_clean(self): 48 def is_clean(self):
42 ''' 49 '''
43 Check if the file is clean from harmful metadatas 50 Check if the file is clean from harmful metadatas
@@ -116,6 +123,11 @@ class GenericParser(object):
116 ''' 123 '''
117 raise NotImplementedError 124 raise NotImplementedError
118 125
126 def create_backup_copy(self):
127 ''' Create a backup copy
128 '''
129 shutil.copy2(self.filename, self.filename + '.bak')
130
119 def do_backup(self): 131 def do_backup(self):
120 ''' 132 '''
121 Keep a backup of the file if asked. 133 Keep a backup of the file if asked.