Correctly delete temp files

FileName::erase() only clears the file name, if you want to delete the file
you need to call FileName::removeFile().
This commit is contained in:
Georg Baum 2013-02-05 21:24:41 +01:00
parent 3408ca4204
commit 067fbe49cd

View File

@ -269,7 +269,7 @@ bool RCS::isCheckInWithConfirmation()
FileName(owner_->filePath())); FileName(owner_->filePath()));
docstring diff = tmpf.fileContents("UTF-8"); docstring diff = tmpf.fileContents("UTF-8");
tmpf.erase(); tmpf.removeFile();
if (diff.empty()) if (diff.empty())
return false; return false;
@ -845,7 +845,7 @@ string CVS::checkOut()
rc = 0; rc = 0;
} }
tmpf.erase(); tmpf.removeFile();
return rc ? string() : log.empty() ? "CVS: Proceeded" : "CVS: " + log; return rc ? string() : log.empty() ? "CVS: Proceeded" : "CVS: " + log;
} }
@ -1195,7 +1195,7 @@ LyXVC::CommandResult SVN::checkIn(string const & msg, string & log)
if (!fileLock(false, tmpf, log)) if (!fileLock(false, tmpf, log))
ret = LyXVC::ErrorCommand; ret = LyXVC::ErrorCommand;
tmpf.erase(); tmpf.removeFile();
if (!log.empty()) if (!log.empty())
log.insert(0, "SVN: "); log.insert(0, "SVN: ");
if (ret == LyXVC::Success && log.empty()) if (ret == LyXVC::Success && log.empty())
@ -1228,7 +1228,7 @@ bool SVN::isCheckInWithConfirmation()
FileName(owner_->filePath())); FileName(owner_->filePath()));
docstring diff = tmpf.fileContents("UTF-8"); docstring diff = tmpf.fileContents("UTF-8");
tmpf.erase(); tmpf.removeFile();
if (diff.empty()) if (diff.empty())
return false; return false;
@ -1324,7 +1324,7 @@ string SVN::checkOut()
fileLock(true, tmpf, log); fileLock(true, tmpf, log);
tmpf.erase(); tmpf.removeFile();
return log.empty() ? string() : "SVN: " + log; return log.empty() ? string() : "SVN: " + log;
} }
@ -1367,7 +1367,7 @@ string SVN::repoUpdate()
hideDialogs("file", 0); hideDialogs("file", 0);
} }
if (ret == 1 ) { if (ret == 1 ) {
tmpf.erase(); tmpf.removeFile();
return string(); return string();
} }
} }
@ -1383,7 +1383,7 @@ string SVN::repoUpdate()
res += "Update log:\n" + tmpf.fileContents("UTF-8"); res += "Update log:\n" + tmpf.fileContents("UTF-8");
LYXERR(Debug::LYXVC, res); LYXERR(Debug::LYXVC, res);
tmpf.erase(); tmpf.removeFile();
return to_utf8(res); return to_utf8(res);
} }
@ -1424,7 +1424,7 @@ string SVN::lockingToggle()
if (ret) if (ret)
return string(); return string();
tmpf.erase(); tmpf.removeFile();
frontend::Alert::warning(_("SVN File Locking"), frontend::Alert::warning(_("SVN File Locking"),
(locking ? _("Locking property unset.") : _("Locking property set.")) + "\n" (locking ? _("Locking property unset.") : _("Locking property set.")) + "\n"
+ _("Do not forget to commit the locking property into the repository."), + _("Do not forget to commit the locking property into the repository."),
@ -1561,7 +1561,7 @@ bool SVN::getFileRevisionInfo()
} }
ifs.close(); ifs.close();
tmpf.erase(); tmpf.removeFile();
return !rev.empty(); return !rev.empty();
} }
@ -1585,7 +1585,7 @@ bool SVN::getTreeRevisionInfo()
string line; string line;
getline(ifs, line); getline(ifs, line);
ifs.close(); ifs.close();
tmpf.erase(); tmpf.removeFile();
rev_tree_cache_ = line; rev_tree_cache_ = line;
return !line.empty(); return !line.empty();