Skip to content

Commit c67a43c

Browse files
committed
Output a different error message with the reason why wxm files could not be read.
Is it a permission problem, or is the file format issue? Maybe we must introduce something like version 2 of WXM in the future (issue #1907)?
1 parent 2cc73b7 commit c67a43c

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/wxMaxima.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ wxDECLARE_APP(MyApp);
136136
#define CALL_MEMBER_FN(object, ptrToMember) ((object).*(ptrToMember))
137137

138138
void wxMaxima::ConfigChanged() {
139-
139+
140140
if (GetWorksheet() && (GetWorksheet()->GetTree()))
141141
GetWorksheet()->GetTree()->FontsChangedList();
142142

@@ -1943,7 +1943,7 @@ wxMaxima::~wxMaxima() {
19431943
}
19441944
fil.Close();
19451945
}
1946-
1946+
19471947
// Allow the operating system to keep the clipboard's contents even after we
19481948
// exit - if that option is supported by the OS.
19491949
if (wxTheClipboard->Open()) {
@@ -2015,9 +2015,9 @@ void wxMaxima::ConsoleAppend(wxXmlDocument xml, CellType type,
20152015
const wxString &userLabel) {
20162016
if(!GetWorksheet())
20172017
return;
2018-
2018+
20192019
// If we want to append an error message to the worksheet and there is no cell
2020-
// that can contain it we need to create such a cell.
2020+
// that can contain it we need to create such a cell.
20212021
if (GetWorksheet()->GetTree() == NULL)
20222022
GetWorksheet()->InsertGroupCells(
20232023
std::make_unique<GroupCell>(&m_configuration, GC_TYPE_CODE));
@@ -2336,7 +2336,7 @@ void wxMaxima::SendMaxima(wxString s, bool addToHistory) {
23362336
{
23372337
if (m_varRegEx.Matches(line))
23382338
GetWorksheet()->AddSymbol(m_varRegEx.GetMatch(line, 1));
2339-
2339+
23402340
if (m_funRegEx.Matches(line)) {
23412341
wxString funName = m_funRegEx.GetMatch(line, 1);
23422342
GetWorksheet()->AddSymbol(funName);
@@ -3898,7 +3898,7 @@ void wxMaxima::ReadPrompt(const wxString &data) {
38983898
m_evalOnStartup = false;
38993899
if(!GetWorksheet())
39003900
return;
3901-
3901+
39023902
GetWorksheet()->SetCurrentTextCell(nullptr);
39033903

39043904
// Assume we don't have a question prompt
@@ -4137,7 +4137,7 @@ bool wxMaxima::OpenWXMFile(const wxString &file, Worksheet *document,
41374137
wxTextFile inputFile(file);
41384138

41394139
if (!inputFile.Open()) {
4140-
LoggingMessageBox(_("wxMaxima encountered an error loading ") + file,
4140+
LoggingMessageBox(_("wxMaxima encountered an error loading ") + file + " (Maybe a permission problem?)",
41414141
_("Error"), wxOK | wxICON_EXCLAMATION);
41424142
StatusMaximaBusy(StatusBar::MaximaStatus::waiting);
41434143
StatusText(_("File could not be opened"));
@@ -4146,7 +4146,7 @@ bool wxMaxima::OpenWXMFile(const wxString &file, Worksheet *document,
41464146

41474147
if (inputFile.GetFirstLine() != Format::WXMFirstLine) {
41484148
inputFile.Close();
4149-
LoggingMessageBox(_("wxMaxima encountered an error loading ") + file,
4149+
LoggingMessageBox(_("wxMaxima encountered an error loading ") + file + " (File format (WXM version 1, first line of the file) not recognized)", // FIXME: The error message could be improved...
41504150
_("Error"), wxOK | wxICON_EXCLAMATION);
41514151
return false;
41524152
}
@@ -5943,7 +5943,7 @@ bool wxMaxima::AutoSave() {
59435943
&GetWorksheet()->GetCellPointers(),
59445944
m_variablesPane->GetVarnames(),
59455945
GetWorksheet()->GetHCaret());
5946-
5946+
59475947
wxLogMessage(_("Autosaving as temp file %s"), m_tempfileName.utf8_str());
59485948
if ((m_tempfileName != oldTempFile) && saved) {
59495949
GetWorksheet()->SetSaved(true);

0 commit comments

Comments
 (0)