From 9f4f081ea08d0dfb931b3d2d9679eaabbff9817e Mon Sep 17 00:00:00 2001 From: Lucas Thode Date: Thu, 28 Oct 2010 08:26:06 -0500 Subject: [PATCH] Improved file-extension handling. --- gui/mainFrame.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gui/mainFrame.py b/gui/mainFrame.py index 33b5fec46..c85514d32 100644 --- a/gui/mainFrame.py +++ b/gui/mainFrame.py @@ -34,6 +34,7 @@ from gui.preferenceDialog import PreferenceDialog import aboutData import gui.fittingView as fv from wx._core import PyDeadObjectError +import os.path class MainFrame(wx.Frame): __instance = None @@ -183,11 +184,11 @@ class MainFrame(wx.Frame): path = dlg.GetPath() if (format == 0): output = sFit.exportFit(self.getActiveFit()) - if not path.endswith(".cfg"): + if '.' not in os.path.basename(path): path += ".cfg" elif (format == 1): output = sFit.exportXml(self.getActiveFit()) - if not path.endswith(".xml"): + if '.' not in os.path.basename(path): path += ".xml" else: print "oops, invalid fit format %d" % format @@ -281,7 +282,7 @@ class MainFrame(wx.Frame): style = wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT) if (saveDialog.ShowModal() == wx.ID_OK): filePath = saveDialog.GetPath() - if not filePath.endswith(".xml"): + if '.' not in os.path.basename(filePath): filePath += ".xml" sFit.backupFits(filePath ) saveDialog.Destroy()