]> git.lyx.org Git - lyx.git/blobdiff - src/importer.C
hopefully fix tex2lyx linking.
[lyx.git] / src / importer.C
index 6d4801249a00754d9f1bc6d111d6093c459debc6..b37c9f0cfa89e3db9c5ff4c051f277025e01a982 100644 (file)
 #include "BufferView.h"
 #include "buffer_funcs.h"
 
-using lyx::docstring;
-using lyx::support::bformat;
-using lyx::support::changeExtension;
-using lyx::support::makeDisplayPath;
+
+namespace lyx {
+
+using support::bformat;
+using support::changeExtension;
+using support::makeDisplayPath;
 
 using std::find;
 using std::string;
@@ -51,21 +53,25 @@ bool Importer::Import(LyXView * lv, string const & filename,
                for (vector<string>::const_iterator it = loaders.begin();
                     it != loaders.end(); ++it) {
                        if (converters.isReachable(format, *it)) {
-                               if (!converters.convert(0, filename, filename,
-                                                       format, *it, errorList))
+                               string const tofile =
+                                       changeExtension(filename,
+                                               formats.extension(*it));
+                               if (!converters.convert(0, filename, tofile,
+                                                       filename, format, *it, errorList))
                                        return false;
                                loader_format = *it;
                                break;
                        }
                }
                if (loader_format.empty()) {
-                       lyx::frontend::Alert::error(_("Couldn't import file"),
+                       frontend::Alert::error(_("Couldn't import file"),
                                     bformat(_("No information for importing the format %1$s."),
                                         formats.prettyName(format)));
                        return false;
                }
-       } else
+       } else {
                loader_format = format;
+       }
 
 
        if (loader_format == "lyx") {
@@ -113,3 +119,6 @@ vector<string> const Importer::Loaders()
        v.push_back("textparagraph");
        return v;
 }
+
+
+} // namespace lyx