Not so soon, I guess, since that FIXME was from r6305.
[lyx.git] / src / output.cpp
blob149ba78cea6e9a7fbf3b196784bf20b9cbe635eb
1 /**
2 * \file output.cpp
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Lars Gullik Bjønnes
8 * Full author contact details are available in file CREDITS.
9 */
11 #include <config.h>
13 #include "output.h"
15 #include "support/gettext.h"
17 #include "frontends/alert.h"
19 #include "support/FileName.h"
20 #include "support/filetools.h"
21 #include "support/lstrings.h"
23 using namespace std;
24 using namespace lyx::support;
26 namespace lyx {
28 namespace {
30 template<typename OFStream>
31 bool doOpenFileWrite(OFStream & ofs, FileName const & fname)
33 ofs.open(fname.toFilesystemEncoding().c_str());
34 if (ofs)
35 return true;
36 docstring const file = fname.displayName(50);
37 docstring text = bformat(_("Could not open the specified "
38 "document\n%1$s."), file);
39 frontend::Alert::error(_("Could not open file"), text);
40 return false;
46 bool openFileWrite(ofstream & ofs, FileName const & fname)
48 return doOpenFileWrite(ofs, fname);
52 bool openFileWrite(ofdocstream & ofs, FileName const & fname)
54 return doOpenFileWrite(ofs, fname);
58 } // namespace lyx