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.
17 #include "frontends/Alert.h"
19 #include "support/filetools.h"
24 using support::bformat;
25 using support::FileName;
26 using support::makeDisplayPath;
33 template<typename OFStream>
34 bool doOpenFileWrite(OFStream & ofs, FileName const & fname)
36 ofs.open(fname.toFilesystemEncoding().c_str());
38 docstring const file = makeDisplayPath(fname.absFilename(), 50);
39 docstring text = bformat(_("Could not open the specified "
40 "document\n%1$s."), file);
41 frontend::Alert::error(_("Could not open file"), text);
50 bool openFileWrite(ofstream & ofs, FileName const & fname)
52 return doOpenFileWrite(ofs, fname);
56 bool openFileWrite(odocfstream & ofs, FileName const & fname)
58 return doOpenFileWrite(ofs, fname);