]> git.lyx.org Git - features.git/commitdiff
Add debug output if unable to open preferences.xform for read/write.
authorAngus Leeming <leeming@lyx.org>
Mon, 29 Dec 2003 13:21:44 +0000 (13:21 +0000)
committerAngus Leeming <leeming@lyx.org>
Mon, 29 Dec 2003 13:21:44 +0000 (13:21 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8277 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/xforms/ChangeLog
src/frontends/xforms/xforms_helpers.C

index 8475f9eb13ffd4064492f77bb42a27e940486e3b..dd2fbaba5531ed1d412d502d6b8decc7e1c2f9fb 100644 (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.
index 597e9938d22602178640b154d8bbc773aab6cb57..d8e49c4cea35d438a7e082a6d26b645b79c16355 100644 (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"