diff --git a/src/Buffer.cpp b/src/Buffer.cpp index 7ea74bdb22..f218e99049 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -817,7 +817,7 @@ bool Buffer::save() const backupName = FileName(addName(lyxrc.backupdir_path, mangledName)); } - if (fileName().copyTo(backupName, true)) { + if (fileName().copyTo(backupName)) { madeBackup = true; } else { Alert::error(_("Backup failure"), diff --git a/src/EmbeddedFiles.cpp b/src/EmbeddedFiles.cpp index d8756b1d9e..6c6fffec4d 100644 --- a/src/EmbeddedFiles.cpp +++ b/src/EmbeddedFiles.cpp @@ -142,7 +142,7 @@ bool EmbeddedFile::extract(Buffer const * buf) const return false; } - if (emb.copyTo(ext, true)) + if (emb.copyTo(ext)) return true; Alert::error(_("Copy file failure"), @@ -184,7 +184,7 @@ bool EmbeddedFile::updateFromExternalFile(Buffer const * buf) const FileName path = emb.onlyPath(); if (!path.isDirectory()) path.createPath(); - if (ext.copyTo(emb, true)) + if (ext.copyTo(emb)) return true; Alert::error(_("Copy file failure"), bformat(_("Cannot copy file %1$s to %2$s.\n" @@ -287,7 +287,7 @@ bool EmbeddedFiles::writeFile(DocFileName const & filename) ::zipFiles(zipfile.toFilesystemEncoding(), filenames); // copy file back - if (!zipfile.copyTo(filename, true)) { + if (!zipfile.copyTo(filename)) { Alert::error(_("Save failure"), bformat(_("Cannot create file %1$s.\n" "Please check whether the directory exists and is writeable."), diff --git a/src/Mover.cpp b/src/Mover.cpp index 28f2ce950a..990a550cb6 100644 --- a/src/Mover.cpp +++ b/src/Mover.cpp @@ -35,7 +35,7 @@ bool Mover::copy(FileName const & from, FileName const & to) const bool Mover::do_copy(FileName const & from, FileName const & to, string const &) const { - return from.copyTo(to, true); + return from.copyTo(to); } diff --git a/src/insets/InsetBibtex.cpp b/src/insets/InsetBibtex.cpp index 23be923ad0..9f9d21398a 100644 --- a/src/insets/InsetBibtex.cpp +++ b/src/insets/InsetBibtex.cpp @@ -179,7 +179,7 @@ int InsetBibtex::latex(Buffer const & buffer, odocstream & os, FileName const out_file = makeAbsPath(database + ".bib", buffer.masterBuffer()->temppath()); - bool const success = in_file.copyTo(out_file, true); + bool const success = in_file.copyTo(out_file); if (!success) { lyxerr << "Failed to copy '" << in_file << "' to '" << out_file << "'" @@ -238,7 +238,7 @@ int InsetBibtex::latex(Buffer const & buffer, odocstream & os, base = removeExtension(in_file.mangledFilename()); FileName const out_file(makeAbsPath(base + ".bst", buffer.masterBuffer()->temppath())); - bool const success = in_file.copyTo(out_file, true); + bool const success = in_file.copyTo(out_file); if (!success) { lyxerr << "Failed to copy '" << in_file << "' to '" << out_file << "'" diff --git a/src/insets/InsetInclude.cpp b/src/insets/InsetInclude.cpp index a983854715..b6a4f0bc6d 100644 --- a/src/insets/InsetInclude.cpp +++ b/src/insets/InsetInclude.cpp @@ -475,7 +475,7 @@ int InsetInclude::latex(Buffer const & buffer, odocstream & os, unsigned long const checksum_out = writefile.checksum(); if (checksum_in != checksum_out) { - if (!included_file.copyTo(writefile, true)) { + if (!included_file.copyTo(writefile)) { // FIXME UNICODE LYXERR(Debug::LATEX, to_utf8(bformat(_("Could not copy the file\n%1$s\n" diff --git a/src/support/FileName.cpp b/src/support/FileName.cpp index e0e10cf07f..1b4a545f3f 100644 --- a/src/support/FileName.cpp +++ b/src/support/FileName.cpp @@ -139,10 +139,9 @@ void FileName::erase() } -bool FileName::copyTo(FileName const & name, bool overwrite) const +bool FileName::copyTo(FileName const & name) const { - if (overwrite) - QFile::remove(name.d->fi.absoluteFilePath()); + QFile::remove(name.d->fi.absoluteFilePath()); bool success = QFile::copy(d->fi.absoluteFilePath(), name.d->fi.absoluteFilePath()); if (!success) lyxerr << "FileName::copyTo(): Could not copy file " diff --git a/src/support/FileName.h b/src/support/FileName.h index fd63ce5e53..dd3932a2dd 100644 --- a/src/support/FileName.h +++ b/src/support/FileName.h @@ -90,9 +90,9 @@ public: /// copy a file /// \return true when file/directory is writable (write test file) - /// \param overwrite: set to true if we should erase the \c target - /// file if it exists, - bool copyTo(FileName const & target, bool overwrite = false) const; + /// \warning This methods has different semantics when system level + /// copy command, it will overwrite the \c target file if it exists, + bool copyTo(FileName const & target) const; /// remove pointed file. /// \return true on success.