Add debug output if unable to open preferences.xform for read/write.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8277 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2003-12-29 13:21:44 +00:00
parent 207ea41f2f
commit 9605ba087d
2 changed files with 17 additions and 4 deletions

View File

@ -1,3 +1,8 @@
2003-12-28 Angus Leeming <leeming@lyx.org>
* xforms_helpers.C (read, write): output a diagnostic message if
we fail to open preferences.xform for read/write.
2003-12-15 Angus Leeming <leeming@lyx.org>
* Color.h (NamedColor): store both the LyX and the GUI name.

View File

@ -12,6 +12,7 @@
#include "xforms_helpers.h"
#include "debug.h"
#include "gettext.h"
#include "lyxgluelength.h"
#include "lyxlex.h"
@ -319,9 +320,13 @@ const int xformCount = sizeof(xformTags) / sizeof(keyword_item);
bool XformsColor::read(string const & filename)
{
FileInfo const f(filename);
LyXLex lexrc(xformTags, xformCount);
if (!lexrc.setFile(filename))
return false;
if (f.readable() && !lexrc.setFile(filename)) {
lyxerr << "XformsColor::read(" << filename << ")\n"
<< _("Failed to open file.") << std::endl;
return false;
}
while (lexrc.isOK()) {
int const le = lexrc.lex();
@ -362,8 +367,11 @@ bool XformsColor::read(string const & filename)
bool XformsColor::write(string const & filename)
{
ofstream os(filename.c_str());
if (!os)
return false;
if (!os) {
lyxerr << "XformsColor::write(" << filename << ")\n"
<< _("Failed to open file.") << std::endl;
return false;
}
os << "###"
<< "### file " << filename << "\n\n"