Simplify the mover semantics a bit further: The extra variable being passed in

the deleted functions was never actually used, and it hasn't been for a very
long time. So the comment about the "other version" of Mover::copy() was way
out of date.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26683 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2008-10-02 14:41:07 +00:00
parent 4e02ce0a9b
commit 4dc976497f
4 changed files with 5 additions and 34 deletions

View File

@ -287,8 +287,7 @@ void ConverterCache::add(FileName const & orig_from, string const & to_format,
return; return;
} }
item->checksum = checksum; item->checksum = checksum;
if (!mover.copy(converted_file, item->cache_name, if (!mover.copy(converted_file, item->cache_name)) {
onlyFilename(item->cache_name.absFilename()))) {
LYXERR(Debug::FILES, "Could not copy file " << orig_from << " to " LYXERR(Debug::FILES, "Could not copy file " << orig_from << " to "
<< item->cache_name); << item->cache_name);
} else if (!item->cache_name.changePermission(0600)) { } else if (!item->cache_name.changePermission(0600)) {
@ -298,8 +297,7 @@ void ConverterCache::add(FileName const & orig_from, string const & to_format,
} else { } else {
CacheItem new_item(orig_from, to_format, timestamp, CacheItem new_item(orig_from, to_format, timestamp,
orig_from.checksum()); orig_from.checksum());
if (mover.copy(converted_file, new_item.cache_name, if (mover.copy(converted_file, new_item.cache_name)) {
onlyFilename(new_item.cache_name.absFilename()))) {
if (!new_item.cache_name.changePermission(0600)) { if (!new_item.cache_name.changePermission(0600)) {
LYXERR(Debug::FILES, "Could not change file mode" LYXERR(Debug::FILES, "Could not change file mode"
<< new_item.cache_name); << new_item.cache_name);
@ -435,8 +433,7 @@ bool ConverterCache::copy(FileName const & orig_from, string const & to_format,
CacheItem * const item = pimpl_->find(orig_from, to_format); CacheItem * const item = pimpl_->find(orig_from, to_format);
LASSERT(item, /**/); LASSERT(item, /**/);
Mover const & mover = getMover(to_format); Mover const & mover = getMover(to_format);
return mover.copy(item->cache_name, dest, return mover.copy(item->cache_name, dest);
onlyFilename(dest.absFilename()));
} }
} // namespace lyx } // namespace lyx

View File

@ -86,7 +86,7 @@ CopyStatus copyFile(string const & format,
} }
Mover const & mover = getMover(format); Mover const & mover = getMover(format);
if (!mover.copy(sourceFile, destFile, latexFile)) if (!mover.copy(sourceFile, destFile))
Alert::error(_("Couldn't copy file"), Alert::error(_("Couldn't copy file"),
bformat(_("Copying %1$s to %2$s failed."), bformat(_("Copying %1$s to %2$s failed."),
makeDisplayPath(sourceFile.absFilename()), makeDisplayPath(sourceFile.absFilename()),

View File

@ -27,13 +27,6 @@ namespace lyx {
bool Mover::copy(FileName const & from, FileName const & to) const bool Mover::copy(FileName const & from, FileName const & to) const
{
return do_copy(from, to, to.absFilename());
}
bool Mover::do_copy(FileName const & from, FileName const & to,
string const &) const
{ {
return from.copyTo(to); return from.copyTo(to);
} }
@ -57,7 +50,7 @@ bool SpecialisedMover::do_copy(FileName const & from, FileName const & to,
string const & latex) const string const & latex) const
{ {
if (command_.empty()) if (command_.empty())
return Mover::do_copy(from, to, latex); return Mover::copy(from, to);
string command = libScriptSearch(command_); string command = libScriptSearch(command_);
command = subst(command, "$$i", quoteName(from.toFilesystemEncoding())); command = subst(command, "$$i", quoteName(from.toFilesystemEncoding()));

View File

@ -38,21 +38,6 @@ public:
bool bool
copy(support::FileName const & from, support::FileName const & to) const; copy(support::FileName const & from, support::FileName const & to) const;
/** Copy file @c from to @c to.
* \see SpecialisedMover::SpecialisedMover() for an explanation of
* @c latex.
* This version should be used to copy files from the temporary
* directory to the export location, since @c to and @c latex may
* not be equal in this case.
* \returns true if successful.
*/
bool
copy(support::FileName const & from, support::FileName const & to,
std::string const & latex) const
{
return do_copy(from, to, latex);
}
/** Rename file @c from as @c to. /** Rename file @c from as @c to.
* This version should be used to move files from the original * This version should be used to move files from the original
* location to the temporary directory, since @c to and @c latex * location to the temporary directory, since @c to and @c latex
@ -78,10 +63,6 @@ public:
} }
protected: protected:
virtual bool
do_copy(support::FileName const & from, support::FileName const & to,
std::string const &) const;
virtual bool virtual bool
do_rename(support::FileName const & from, support::FileName const & to, do_rename(support::FileName const & from, support::FileName const & to,
std::string const &) const; std::string const &) const;