-/* This file is part of
- * ======================================================
- *
- * LyX, The Document Processor
- *
- * Copyright 1995 Matthias Ettrich
- * Copyright 1995-2000 The LyX Team.
+/**
+ * \file lastfiles.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
*
- * ====================================================== */
+ * \author Lars Gullik Bjønnes
+ *
+ * Full author contact details are available in file CREDITS.
+ */
#include <config.h>
+#include "lastfiles.h"
+#include "debug.h"
-#ifdef __GNUG__
-#pragma implementation
-#endif
+#include <boost/filesystem/operations.hpp>
-#include <fstream>
#include <algorithm>
+#include <fstream>
+#include <iterator>
-#include "support/FileInfo.h"
-#include "lastfiles.h"
-#include "debug.h"
+namespace fs = boost::filesystem;
+using std::copy;
+using std::endl;
+using std::find;
+using std::getline;
+using std::string;
using std::ifstream;
using std::ofstream;
-using std::copy;
using std::ostream_iterator;
-using std::find;
-using std::endl;
+
LastFiles::LastFiles(string const & filename, bool st, unsigned int num)
: dostat(st)
// we issue a warning. (Lgb)
ifstream ifs(filename.c_str());
string tmp;
- FileInfo fileInfo;
- while(getline(ifs, tmp) && files.size() < num_files) {
- if (dostat) {
- if (!(fileInfo.newFile(tmp).exist() &&
- fileInfo.isRegular()))
+ while (getline(ifs, tmp) && files.size() < num_files) {
+ if (dostat && !fs::exists(tmp))
continue;
- }
files.push_back(tmp);
}
}
}
-string LastFiles::operator[](unsigned int i) const
+string const LastFiles::operator[](unsigned int i) const
{
if (i < files.size())
return files[i];