summaryrefslogtreecommitdiff
path: root/lib/parser.py
diff options
context:
space:
mode:
authorjvoisin2011-06-24 19:41:51 +0200
committerjvoisin2011-06-24 19:41:51 +0200
commit9ebc62273ec8abfc4520660597fa80fe3de40203 (patch)
treef1d6f4ed1824a46b9dcc7ab142950cc0eb04692c /lib/parser.py
parent15e58d472dd942a675110cff8085124c0088f54f (diff)
Preliminary support of .tar archives
Diffstat (limited to 'lib/parser.py')
-rw-r--r--lib/parser.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/parser.py b/lib/parser.py
index d629619..12ef15a 100644
--- a/lib/parser.py
+++ b/lib/parser.py
@@ -6,6 +6,7 @@ import hachoir_core.error
6import hachoir_parser 6import hachoir_parser
7import hachoir_editor 7import hachoir_editor
8import sys 8import sys
9import os
9import shutil 10import shutil
10 11
11POSTFIX = ".cleaned" 12POSTFIX = ".cleaned"
@@ -25,6 +26,7 @@ class Generic_parser():
25 #FIXME : not secure at all ! 26 #FIXME : not secure at all !
26 try: 27 try:
27 shutil.rmtree(self.filename) 28 shutil.rmtree(self.filename)
29 #shutil.subprocess('shutil' , '--remove', 'self.filename')
28 except: 30 except:
29 print('Unable to remove %s' % self.filename) 31 print('Unable to remove %s' % self.filename)
30 32
@@ -47,7 +49,7 @@ class Generic_parser():
47 hachoir_core.field.writeIntoFile(self.editor, self.filename + POSTFIX) 49 hachoir_core.field.writeIntoFile(self.editor, self.filename + POSTFIX)
48 if self.backup is False: 50 if self.backup is False:
49 self.secure_remove() #remove the old file 51 self.secure_remove() #remove the old file
50 shutil.rename(self.filename+ POSTFIX, self.filename)#rename the new 52 os.rename(self.filename+ POSTFIX, self.filename)#rename the new
51 53
52 def remove_all_ugly(self): 54 def remove_all_ugly(self):
53 ''' 55 '''
@@ -57,7 +59,7 @@ class Generic_parser():
57 In a perfect world, with nice fileformat, 59 In a perfect world, with nice fileformat,
58 this method does not exist. 60 this method does not exist.
59 ''' 61 '''
60 raise NotImplementedError() 62 self.remove_all()
61 63
62 64
63 def _remove(self, field): 65 def _remove(self, field):