#include <config.h>
#include "support/FileMonitor.h"
+
#include "support/FileName.h"
-#include "support/lyxlib.h"
#include "support/Timeout.h"
#include <boost/bind.hpp>
-#include <boost/filesystem/operations.hpp>
#include <boost/signals/trackable.hpp>
-
-using std::string;
-
-namespace fs = boost::filesystem;
+using namespace std;
namespace lyx {
namespace support {
FileMonitor::~FileMonitor()
-{}
+{
+ delete pimpl_;
+}
void FileMonitor::reset(FileName const & file_with_path) const
if (monitoring())
return;
- if (!fs::exists(pimpl_->filename_.toFilesystemEncoding()))
+ if (!pimpl_->filename_.exists())
return;
- pimpl_->timestamp_ = fs::last_write_time(pimpl_->filename_.toFilesystemEncoding());
- pimpl_->checksum_ = sum(pimpl_->filename_);
+ pimpl_->timestamp_ = pimpl_->filename_.lastModified();
+ pimpl_->checksum_ = pimpl_->filename_.checksum();
if (pimpl_->timestamp_ && pimpl_->checksum_) {
pimpl_->timer_.start();
// If we aren't actively monitoring the file, then recompute the
// checksum explicitly.
if (!pimpl_->timer_.running() && !pimpl_->filename_.empty())
- return sum(pimpl_->filename_);
+ return pimpl_->filename_.checksum();
return pimpl_->checksum_;
}
{
bool changed = false;
- if (!fs::exists(filename_.toFilesystemEncoding())) {
+ if (!filename_.exists()) {
changed = timestamp_ || checksum_;
timestamp_ = 0;
checksum_ = 0;
} else {
- time_t const new_timestamp = fs::last_write_time(filename_.toFilesystemEncoding());
+ time_t const new_timestamp = filename_.lastModified();
if (new_timestamp != timestamp_) {
timestamp_ = new_timestamp;
- unsigned long const new_checksum = sum(filename_);
+ unsigned long const new_checksum = filename_.checksum();
if (new_checksum != checksum_) {
checksum_ = new_checksum;
changed = true;