diff options
| -rw-r--r-- | photoblaster/_file.py | 22 | ||||
| -rwxr-xr-x | photoblaster/modules/pbbreaker.py | 18 |
2 files changed, 11 insertions, 29 deletions
diff --git a/photoblaster/_file.py b/photoblaster/_file.py index b370bb4..654f305 100644 --- a/photoblaster/_file.py +++ b/photoblaster/_file.py @@ -67,19 +67,15 @@ class File(object): name += ".%s" % self.extension self._filename = name - def set_filepath( - self, - directory=WORKING_DIR, - filepath=None - ): - """creates a local working path""" - if filepath: - self._filepath = filepath - self.set_filename(filename=os.path.basename(filepath)) - return - if self._is_temp: - self.directory = WORKING_DIR - self._filepath = os.path.join(directory, self.get_filename()) + def set_filepath(self, filepath, module=None): + """sets the filepath""" + if os.path.exits(self._filepath): + cmd = ['mv', self._filepath, filepath] + if module: + module.commands.append(" ".join(cmd)) + self._filepath = filepath + self.set_filename(filename=os.path.basename(filepath)) + self._directory = os.path.dirname(filepath) def get_filepath(self): return os.path.join(self._directory, self.get_filename()) diff --git a/photoblaster/modules/pbbreaker.py b/photoblaster/modules/pbbreaker.py index d282513..8ef77a8 100755 --- a/photoblaster/modules/pbbreaker.py +++ b/photoblaster/modules/pbbreaker.py @@ -198,23 +198,9 @@ class PbBreaker(Pb): r'\.', "-%s." % num, self.get_output_file().get_filepath()) ) if str(self.params.breaktype) == 'psd': - self._call_cmd( - [ - 'mv', psd_psbfilepath(1), - self.get_output_file().get_filepath() - ] - ) - self._output_file.set_filepath(filepath=psd_psbfilepath(0)) - self._files_created.append(self.get_output_file()) + self.get_output_file().set_filepath(psd_psbfilepath(1), module=self) if str(self.params.breaktype) == 'psb': - self._call_cmd( - [ - 'mv', - psd_psbfilepath(0), - self.get_output_file().get_filepath() - ]) - self._output_file.set_filepath(filepath=psd_psbfilepath(1)) - self._files_created.append(self.get_output_file()) + self.get_output_file().set_filepath(psd_psbfilepath(0), module=self) if self.params.breakangle: self._rotate_back() |
