+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.
#include "xforms_helpers.h"
+#include "debug.h"
#include "gettext.h"
#include "lyxgluelength.h"
#include "lyxlex.h"
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();
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"