From b26ffdd4aab1b59749dda8906bfc8c38adf048f5 Mon Sep 17 00:00:00 2001 From: PadLex Date: Wed, 6 Jul 2022 23:38:45 +0200 Subject: [PATCH] Fix file naming --- laser/laser.inx | 1 - laser/laser.py | 15 ++++++--------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/laser/laser.inx b/laser/laser.inx index 4796428..ba91e63 100644 --- a/laser/laser.inx +++ b/laser/laser.inx @@ -16,7 +16,6 @@ -- Choose Output Directory -- output.gcode - false true diff --git a/laser/laser.py b/laser/laser.py index 9576d84..688b6b4 100644 --- a/laser/laser.py +++ b/laser/laser.py @@ -49,20 +49,17 @@ def effect(self): TOLERANCES["approximation"] = float(self.options.approximation_tolerance.replace(',', '.')) # Construct output path - # Construct output path - if self.options.filename_dynamic and self.document_path(): + if self.options.filename: + output_path = os.path.join(self.options.directory, self.options.filename) + if '.' not in output_path: + output_path += ".gcode" + else: filename, extension = self.document_path().split('.') filename = filename.split('/')[-1] + '.gcode' output_path = os.path.join(self.options.directory, filename) - else: - output_path = os.path.join(self.options.directory, self.options.filename) if self.options.filename_suffix: - try: - filename, extension = output_path.split('.') - except: - self.msg("Error in output directory!") - exit(1) + filename, extension = output_path.split('.') n = 1 while os.path.isfile(output_path):