]> git.lyx.org Git - lyx.git/blobdiff - src/Buffer.cpp
Remove the bogus fixme.
[lyx.git] / src / Buffer.cpp
index 4876f9fc5a802fc78ae9c780d4e7236035e76b40..04ac90c0f96d5f99543d14e0f56364653c95f268 100644 (file)
@@ -930,7 +930,7 @@ Buffer::ReadStatus Buffer::readFile(Lexer & lex, FileName const & filename,
                        << ' ' << quoteName(lyx2lyx.toFilesystemEncoding())
                        << " -t " << convert<string>(LYX_FORMAT)
                        << " -o " << quoteName(tmpfile.toFilesystemEncoding())
-                       << ' ' << quoteName(filename.toFilesystemEncoding());
+                       << ' ' << quoteName(filename.toSafeFilesystemEncoding());
                string const command_str = command.str();
 
                LYXERR(Debug::INFO, "Running '" << command_str << '\'');
@@ -977,8 +977,6 @@ bool Buffer::save() const
        // We don't need autosaves in the immediate future. (Asger)
        resetAutosaveTimers();
 
-       string const encodedFilename = d->filename.toFilesystemEncoding();
-
        FileName backupName;
        bool madeBackup = false;
 
@@ -1036,11 +1034,13 @@ bool Buffer::writeFile(FileName const & fname) const
                makeDisplayPath(fname.absFilename()));
        message(str);
 
+       string const encoded_fname = fname.toSafeFilesystemEncoding(os::CREATE);
+
        if (params().compressed) {
-               gz::ogzstream ofs(fname.toFilesystemEncoding().c_str(), ios::out|ios::trunc);
+               gz::ogzstream ofs(encoded_fname.c_str(), ios::out|ios::trunc);
                retval = ofs && write(ofs);
        } else {
-               ofstream ofs(fname.toFilesystemEncoding().c_str(), ios::out|ios::trunc);
+               ofstream ofs(encoded_fname.c_str(), ios::out|ios::trunc);
                retval = ofs && write(ofs);
        }
 
@@ -1310,21 +1310,17 @@ void Buffer::writeLaTeXSource(odocstream & os,
                        // We don't know the encoding of inputpath
                        docstring const inputpath = from_utf8(latex_path(original_path));
                        docstring uncodable_glyphs;
-                       for (size_t n = 0; n < inputpath.size(); ++n) {
-                               docstring const glyph = docstring(1, inputpath[n]);
-                               try {
-                                       if (runparams.encoding
-                                           && runparams.encoding->latexChar(inputpath[n]) != glyph) {
+                       Encoding const * const enc = runparams.encoding;
+                       if (enc) {
+                               for (size_t n = 0; n < inputpath.size(); ++n) {
+                                       docstring const glyph =
+                                               docstring(1, inputpath[n]);
+                                       if (enc->latexChar(inputpath[n], true) != glyph) {
                                                LYXERR0("Uncodable character '"
                                                        << glyph
                                                        << "' in input path!");
                                                uncodable_glyphs += glyph;
                                        }
-                               } catch (EncodingException & /* e */) {
-                                       LYXERR0("Uncodable character '"
-                                               << glyph
-                                               << "' in input path!");
-                                       uncodable_glyphs += glyph;
                                }
                        }
 
@@ -1340,9 +1336,9 @@ void Buffer::writeLaTeXSource(odocstream & os,
                                                  "or change the path name."), inputpath, uncodable_glyphs));
                        } else {
                                os << "\\makeatletter\n"
-                                 << "\\def\\input@path{{"
-                                 << inputpath << "/}}\n"
-                                 << "\\makeatother\n";
+                                  << "\\def\\input@path{{"
+                                  << inputpath << "/}}\n"
+                                  << "\\makeatother\n";
                                d->texrow.newline();
                                d->texrow.newline();
                                d->texrow.newline();
@@ -1897,7 +1893,7 @@ void Buffer::dispatch(FuncRequest const & func, DispatchResult & dr)
 
        case LFUN_BUFFER_EXPORT: {
                bool success = doExport(argument, false, false);
-               dr.setError(success);
+               dr.setError(!success);
                if (!success)
                        dr.setMessage(bformat(_("Error exporting to format: %1$s."), 
                                              func.argument()));