diff --git a/src/View/Geometry/Window.py b/src/View/Geometry/Window.py index 13f25e30..0f780035 100644 --- a/src/View/Geometry/Window.py +++ b/src/View/Geometry/Window.py @@ -20,6 +20,7 @@ import os import sys import time import pathlib +from pathlib import Path import logging from copy import deepcopy @@ -685,10 +686,18 @@ class GeometryWindow(PamhyrWindow): ) if filename != '' and filename is not None: - self._export_to_file_st(filename) + suffix = Path(filename).suffix + if suffix != "": + if suffix == ".st" or suffix == ".ST": + self._export_to_file_st(filename[:-3]) + else: + # TODO : prévenir l'utilisateur que le format n'est pas exportable + pass + else: + self._export_to_file_st(filename) def _export_to_file_st(self, filename): - with open(filename, "w+") as f: + with open(filename+".st", "w+") as f: f.write("# Exported from Pamhyr2\n") self._export_to_file_st_reach(f, self._reach)