X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FExternalSupport.cpp;h=6d009a5dd2b13814d9bd7c0c3fdc092d860e7476;hb=d044d6afa7192b2119784e1415e71dad644bc335;hp=7796c796bc2abdf3c45ab229dafab44d08c9fda8;hpb=b6a764eef3f042b26fe58131a2f5bd909db82990;p=lyx.git diff --git a/src/insets/ExternalSupport.cpp b/src/insets/ExternalSupport.cpp index 7796c796bc..6d009a5dd2 100644 --- a/src/insets/ExternalSupport.cpp +++ b/src/insets/ExternalSupport.cpp @@ -89,9 +89,9 @@ string const doSubstitution(InsetExternalParams const & params, buffer.filePath(); string const filename = external_in_tmpdir ? params.filename.mangledFileName() : - params.filename.outputFilename(parentpath); + params.filename.outputFileName(parentpath); string const basename = changeExtension( - onlyFilename(filename), string()); + onlyFileName(filename), string()); string const absname = makeAbsPath(filename, parentpath).absFileName(); string result = s; @@ -333,23 +333,23 @@ string const substituteOptions(InsetExternalParams const & params, } // namespace anon -int writeExternal(InsetExternalParams const & params, - string const & format, - Buffer const & buffer, odocstream & os, - ExportData & exportdata, - bool external_in_tmpdir, - bool dryrun) +void writeExternal(InsetExternalParams const & params, + string const & format, + Buffer const & buffer, otexstream & os, + ExportData & exportdata, + bool external_in_tmpdir, + bool dryrun) { Template const * const et_ptr = getTemplatePtr(params); if (!et_ptr) - return 0; + return; Template const & et = *et_ptr; Template::Formats::const_iterator cit = et.formats.find(format); if (cit == et.formats.end()) { LYXERR(Debug::EXTERNAL, "External template format '" << format << "' not specified in template " << params.templatename()); - return 0; + return; } if (!dryrun || contains(cit->second.product, "$$Contents")) @@ -361,20 +361,29 @@ int writeExternal(InsetExternalParams const & params, use_latex_path, external_in_tmpdir); string const absname = makeAbsPath( - params.filename.outputFilename(buffer.filePath()), buffer.filePath()).absFileName(); - - if (!external_in_tmpdir && !isValidLaTeXFilename(absname)) { - lyx::frontend::Alert::warning(_("Invalid filename"), - _("The following filename is likely to cause trouble " - "when running the exported file through LaTeX: ") + - from_utf8(absname)); + params.filename.outputFileName(buffer.filePath()), buffer.filePath()).absFileName(); + + if (!dryrun && !external_in_tmpdir) { + if (!isValidLaTeXFileName(absname)) { + lyx::frontend::Alert::warning(_("Invalid filename"), + _("The following filename will cause troubles " + "when running the exported file through LaTeX: ") + + from_utf8(absname)); + } + if (!isValidDVIFileName(absname)) { + lyx::frontend::Alert::warning(_("Problematic filename for DVI"), + _("The following filename can cause troubles " + "when running the exported file through LaTeX " + "and opening the resulting DVI: ") + + from_utf8(absname), true); + } } str = substituteCommands(params, str, format); str = substituteOptions(params, str, format); // FIXME UNICODE os << from_utf8(str); - return int(count(str.begin(), str.end(),'\n')); + return; } namespace {