fix broken strerrors

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6638 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
John Levon 2003-03-29 17:35:57 +00:00
parent a3e85a5c27
commit a6737cd9b9
4 changed files with 12 additions and 15 deletions

View File

@ -46,7 +46,6 @@
#include "BoostFormat.h" #include "BoostFormat.h"
#include <fstream> #include <fstream>
#include <cerrno>
extern BufferList bufferlist; extern BufferList bufferlist;
@ -321,16 +320,14 @@ bool BufferView::insertLyXFile(string const & filen)
ifstream ifs(fname.c_str()); ifstream ifs(fname.c_str());
if (!ifs) { if (!ifs) {
string const error = strerror(errno);
string const file = MakeDisplayPath(fname, 50); string const file = MakeDisplayPath(fname, 50);
#if USE_BOOST_FORMAT #if USE_BOOST_FORMAT
boost::format fmt(_("Could not open the specified document\n%1$s\ndue to the error: %2$s")); boost::format fmt(_("Could not open the specified document\n%1$s."));
fmt % file; fmt % file;
fmt % error;
string text = fmt.str(); string text = fmt.str();
#else #else
string text = _("Could not open the specified document\n"); string text = _("Could not open the specified document\n");
text += file + _(" due to the error: "); text += file + ".";
text += error; text += error;
#endif #endif
Alert::error(_("Could not open file"), text); Alert::error(_("Could not open file"), text);

View File

@ -1,3 +1,8 @@
2003-03-29 John Levon <levon@movementarian.org>
* BufferView.C:
* buffer.C: fix broken strerrors according to Lars
2003-03-29 John Levon <levon@movementarian.org> 2003-03-29 John Levon <levon@movementarian.org>
* converters.C: more Alert cleanups * converters.C: more Alert cleanups

View File

@ -954,17 +954,14 @@ void Buffer::writeFileAscii(string const & fname, int linelen)
{ {
ofstream ofs(fname.c_str()); ofstream ofs(fname.c_str());
if (!ofs) { if (!ofs) {
string const error = strerror(errno);
string const file = MakeDisplayPath(fname, 50); string const file = MakeDisplayPath(fname, 50);
#if USE_BOOST_FORMAT #if USE_BOOST_FORMAT
boost::format fmt(_("Could not save the document\n%1$s\ndue to the error: %2$s")); boost::format fmt(_("Could not save the document\n%1$s."));
fmt % file; fmt % file;
fmt % error;
string text = fmt.str(); string text = fmt.str();
#else #else
string text = _("Could not save the document\n"); string text = _("Could not save the document\n");
text += file + _(" due to the error: "); text += file + ".";
text += error;
#endif #endif
Alert::error(_("Could not save document"), text); Alert::error(_("Could not save document"), text);
return; return;
@ -994,17 +991,14 @@ void Buffer::makeLaTeXFile(string const & fname,
ofstream ofs(fname.c_str()); ofstream ofs(fname.c_str());
if (!ofs) { if (!ofs) {
string const error = strerror(errno);
string const file = MakeDisplayPath(fname, 50); string const file = MakeDisplayPath(fname, 50);
#if USE_BOOST_FORMAT #if USE_BOOST_FORMAT
boost::format fmt(_("Could not open the specified document\n%1$s\ndue to the error: %2$s")); boost::format fmt(_("Could not open the specified document\n%1$s."));
fmt % file; fmt % file;
fmt % error;
string text = fmt.str(); string text = fmt.str();
#else #else
string text = _("Could not open the specified document\n"); string text = _("Could not open the specified document\n");
text += file + _(" due to the error: "); text += file + ".";
text += error;
#endif #endif
Alert::error(_("Could not open file"), text); Alert::error(_("Could not open file"), text);
return; return;

View File

@ -41,6 +41,7 @@
#include <fstream> #include <fstream>
#include <algorithm> #include <algorithm>
#include <utility> #include <utility>
#include <cerrno>
using std::vector; using std::vector;
using std::ifstream; using std::ifstream;