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.
15 #include "support/gettext.h"
17 #include "frontends/alert.h"
19 #include "support/filetools.h"
20 #include "support/lstrings.h"
25 using support::bformat;
26 using support::FileName;
33 template<typename OFStream>
34 bool doOpenFileWrite(OFStream & ofs, FileName const & fname)
36 ofs.open(fname.toFilesystemEncoding().c_str());
39 docstring const file = fname.displayName(50);
40 docstring text = bformat(_("Could not open the specified "
41 "document\n%1$s."), file);
42 frontend::Alert::error(_("Could not open file"), text);
49 bool openFileWrite(ofstream & ofs, FileName const & fname)
51 return doOpenFileWrite(ofs, fname);
55 bool openFileWrite(odocfstream & ofs, FileName const & fname)
57 return doOpenFileWrite(ofs, fname);