X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FExporter.cpp;h=073842f2806213c9deeec12add2b61ba351a7c6f;hb=b64d17e9dcaeb84a94095622c93a051e4d93eab7;hp=16ff2a3a8ad55f3d9197456e97f4ad1a8f739e23;hpb=87caf487e1fd3c6b72dd0b982fe7a6c1a38662d1;p=lyx.git diff --git a/src/Exporter.cpp b/src/Exporter.cpp index 16ff2a3a8a..073842f280 100644 --- a/src/Exporter.cpp +++ b/src/Exporter.cpp @@ -44,7 +44,7 @@ static int checkOverwrite(FileName const & filename) docstring text = bformat(_("The file %1$s already exists.\n\n" "Do you want to overwrite that file?"), - makeDisplayPath(filename.absFilename())); + makeDisplayPath(filename.absFileName())); return Alert::prompt(_("Overwrite file?"), text, 0, 3, _("&Keep file"), _("&Overwrite"), @@ -53,7 +53,9 @@ static int checkOverwrite(FileName const & filename) /** copy file \p sourceFile to \p destFile. If \p force is false, the user - * will be asked before existing files are overwritten. + * will be asked before existing files are overwritten. If \p only_tmp + * is true, then only copy files that are in our tmp dir (to avoid other files + * overwriting themselves). * \return * - SUCCESS if this file got copied * - FORCE if subsequent calls should not ask for confirmation before @@ -62,17 +64,16 @@ static int checkOverwrite(FileName const & filename) */ CopyStatus copyFile(string const & format, FileName const & sourceFile, FileName const & destFile, - string const & latexFile, bool force) + string const & latexFile, bool force, bool only_tmp) { CopyStatus ret = force ? FORCE : SUCCESS; - // Only copy files that are in our tmp dir, all other files would - // overwrite themselves. This check could be changed to + // This check could be changed to // boost::filesystem::equivalent(sourceFile, destFile) if export to // other directories than the document directory is desired. // Also don't overwrite files that already exist and are identical // to the source files. - if (!prefixIs(onlyPath(sourceFile.absFilename()), package().temp_dir().absFilename()) + if ((only_tmp && !prefixIs(onlyPath(sourceFile.absFileName()), package().temp_dir().absFileName())) || sourceFile.checksum() == destFile.checksum()) return ret; @@ -95,8 +96,8 @@ CopyStatus copyFile(string const & format, if (!mover.copy(sourceFile, destFile, latexFile)) Alert::error(_("Couldn't copy file"), bformat(_("Copying %1$s to %2$s failed."), - makeDisplayPath(sourceFile.absFilename()), - makeDisplayPath(destFile.absFilename()))); + makeDisplayPath(sourceFile.absFileName()), + makeDisplayPath(destFile.absFileName()))); return ret; } @@ -131,7 +132,7 @@ void ExportData::addExternalFile(string const & format, void ExportData::addExternalFile(string const & format, FileName const & sourceName) { - addExternalFile(format, sourceName, onlyFilename(sourceName.absFilename())); + addExternalFile(format, sourceName, onlyFileName(sourceName.absFileName())); }