Author: derek Date: Fri Apr 4 00:19:38 2008 New Revision: 404 Modified: sofaswitch/trunk/callflow/src/callflow.cpp Log: Allways compile to a .py file Modified: sofaswitch/trunk/callflow/src/callflow.cpp ============================================================================== --- sofaswitch/trunk/callflow/src/callflow.cpp (original) +++ sofaswitch/trunk/callflow/src/callflow.cpp Fri Apr 4 00:19:38 2008 @@ -662,20 +662,24 @@ if (filedlg.ShowModal() != wxID_OK) return; - wxTextFile file(filedlg.GetPath()); + wxString name = filedlg.GetPath(); + if (name.Right(3) != wxString(".py")) + name = name + wxString(".py"); + + wxTextFile file(name); if (!file.Exists()) file.Create(); file.Open(); if (!file.IsOpened()) { - wxMessageBox(wxString::Format("Unable to open the file %s to write data to", filedlg.GetFilename().c_str())); + wxMessageBox(wxString::Format("Unable to open the file %s to write data to", name.c_str())); return; } if (canvas->Compile(file)) - SetStatusText(wxString::Format("wrote compiled code to %s", filedlg.GetFilename().c_str())); + SetStatusText(wxString::Format("wrote compiled code to %s", name.c_str())); else - wxMessageBox(wxString::Format("failed - could not compile code to %s", filedlg.GetFilename().c_str())); + wxMessageBox(wxString::Format("failed - could not compile code to %s", name.c_str())); file.Close(); }