The patch looks good. I think I found one little error and I have also some nitpicks ;-) But in general I would vote for inclusion.
@@ -210,11 +216,21 @@ bool Exporter::Export(Buffer * buffer, s CopyStatus status = SUCCESS; for (vector<ExportedFile>::const_iterator it = files.begin(); it != files.end() && status != CANCEL; ++it) { - string const fmt = - formats.getFormatFromFile(it->sourceName); - status = copyFile(fmt, it->sourceName, - MakeAbsPath(it->exportName, dest), - it->exportName, status == FORCE); + string const path = MakeAbsPath(it->exportName, dest); + if (it->isDirectory) { + if (! IsDirWriteable(path) && ! createDirectory(path,0777)) { I think this should either be ||, not &&: + if (! IsDirWriteable(path) || ! createDirectory(path,0777)) { or you could completely omit the check for IsDirWriteable(path). I would prefer that, because this check should be either there for files and directories or not at all and createDirectory will fail if the path is not writeable. If you omit the check, the title of the error box needs of course to be adjusted. + bformat(_("Copying to directory %1$s failed."), This should be + bformat(_("Creating directory %1$s failed."), @@ -82,15 +85,28 @@ public: */ void addExternalFile(std::string const & format, std::string const & sourceName); + /** add a referenced directory for one format. + * \param format format that references the given file + * \param exportName resulting file name. Can be either absolute + * or relative to the exported document. + */ Please adjust the comment, this is no file ;-) Your code relies on the fact that addExternalDirectory is called before a call to addExternalFile with a file in that directory. You should document that also. Georg