X-Git-Url: https://www.irasnyder.com/gitweb/?p=rarslave2.git;a=blobdiff_plain;f=rarslave.py;h=2e9861a78e097f3e4e888ea261a5c2d16d0527e2;hp=93debabea9725ac7d941c8765dd26506c5c6380e;hb=4eeb9e9a81a129b93ed11eb6023c5e1ec3767693;hpb=66dd8b6203c5e64c827cbb91956c575763fa2df1;ds=sidebyside diff --git a/rarslave.py b/rarslave.py index 93debab..2e9861a 100644 --- a/rarslave.py +++ b/rarslave.py @@ -23,11 +23,11 @@ class RarslaveExtractor (object): self.heads.append (os.path.join (dir, head)) - def extract (self, todir): + def extract (self, todir=None): # Extract all heads of this set # Create the directory $todir if it doesn't exist - if not os.path.isdir (todir): + if todir != None and not os.path.isdir (todir): # TODO: LOGGER try: os.makedirs (todir) @@ -44,7 +44,11 @@ class RarslaveExtractor (object): # Call the extraction function on each head for h in self.heads: - extraction_func (h, todir) + if todir == None: + # Run in the head's directory + extraction_func (h, os.path.dirname (h)) + else: + extraction_func (h, todir) def __extract_rar (self, file, todir): assert os.path.isfile (file)