]> git.lyx.org Git - lyx.git/blob - src/output.C
fix bug 2089: Touching Navigate menu crashes Lyx when a TOC inset is in a section...
[lyx.git] / src / output.C
1 /**
2  * \file output.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Lars Gullik Bjønnes
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "output.h"
14
15 #include "gettext.h"
16
17 #include "frontends/Alert.h"
18
19 #include "support/filetools.h"
20
21 #include <fstream>
22
23 using lyx::support::bformat;
24 using lyx::support::MakeDisplayPath;
25
26 using std::ofstream;
27 using std::string;
28
29 bool openFileWrite(ofstream & ofs, string const & fname)
30 {
31         ofs.open(fname.c_str());
32         if (!ofs) {
33                 string const file = MakeDisplayPath(fname, 50);
34                 string text = bformat(_("Could not open the specified "
35                                         "document\n%1$s."), file);
36                 Alert::error(_("Could not open file"), text);
37                 return false;
38         }
39         return true;
40 }