]> git.lyx.org Git - lyx.git/blobdiff - src/insets/ExternalSupport.C
* In the process of fixing the math background color bug, this commit transfer backgr...
[lyx.git] / src / insets / ExternalSupport.C
index 28ca719992d080d41e95aaa0a665ef8cae8f0289..1f7669b7045a1fed3984387c3598f52962a519d3 100644 (file)
@@ -106,12 +106,16 @@ string const doSubstitution(InsetExternalParams const & params,
                string const masterpath = external_in_tmpdir ?
                        m_buffer->temppath() :
                        m_buffer->filePath();
+               // FIXME UNICODE
                string relToMasterPath = support::onlyPath(
-                               support::makeRelPath(absname, masterpath));
+                               to_utf8(support::makeRelPath(from_utf8(absname),
+                                                            from_utf8(masterpath))));
                if (relToMasterPath == "./")
                        relToMasterPath.clear();
+               // FIXME UNICODE
                string relToParentPath = support::onlyPath(
-                               support::makeRelPath(absname, parentpath));
+                               to_utf8(support::makeRelPath(from_utf8(absname),
+                                                            from_utf8(parentpath))));
                if (relToParentPath == "./")
                        relToParentPath.clear();
 
@@ -163,7 +167,7 @@ string const doSubstitution(InsetExternalParams const & params,
                        '.' + support::getExtension(filename), use_latex_path);
        result = subst_path(result, "$$Tempname", params.tempname().absFilename(), use_latex_path);
        result = subst_path(result, "$$Sysdir",
-                               support::package().system_support(), use_latex_path);
+                               support::package().system_support().absFilename(), use_latex_path);
 
        // Handle the $$Contents(filename) syntax
        if (support::contains(result, "$$Contents(\"")) {
@@ -240,14 +244,6 @@ void updateExternal(InsetExternalParams const & params,
        if (to_format.empty())
                return; // NOT_NEEDED
 
-       if (!theConverters().isReachable(from_format, to_format)) {
-               lyxerr[Debug::EXTERNAL]
-                       << "external::updateExternal. "
-                       << "Unable to convert from "
-                       << from_format << " to " << to_format << endl;
-               return; // FAILURE
-       }
-
        // The master buffer. This is useful when there are multiple levels
        // of include files
        Buffer const * m_buffer = buffer.getMasterBuffer();
@@ -264,7 +260,7 @@ void updateExternal(InsetExternalParams const & params,
                if (from_checksum != temp_checksum) {
                        Mover const & mover = getMover(from_format);
                        if (!mover.copy(params.filename, temp_file)) {
-                               lyxerr[Debug::EXTERNAL]
+                               LYXERR(Debug::EXTERNAL)
                                        << "external::updateExternal. "
                                        << "Unable to copy "
                                        << params.filename << " to " << temp_file << endl;
@@ -319,10 +315,17 @@ void updateExternal(InsetExternalParams const & params,
 
        // FIXME (Abdel 12/08/06): Is there a need to show these errors?
        ErrorList el;
-       /* bool const success = */
+       bool const success =
                theConverters().convert(&buffer, temp_file, abs_to_file,
                                   params.filename, from_format, to_format, el,
                                   Converters::try_default | Converters::try_cache);
+
+       if (!success)
+               LYXERR(Debug::EXTERNAL)
+                       << "external::updateExternal. "
+                       << "Unable to convert from "
+                       << from_format << " to " << to_format << endl;
+
        // return success
 }
 
@@ -350,7 +353,7 @@ int writeExternal(InsetExternalParams const & params,
 
        Template::Formats::const_iterator cit = et.formats.find(format);
        if (cit == et.formats.end()) {
-               lyxerr[Debug::EXTERNAL]
+               LYXERR(Debug::EXTERNAL)
                        << "External template format '" << format
                        << "' not specified in template "
                        << params.templatename() << endl;