X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Flastfiles.C;h=537d611c619938840edd0850f16e007064b24efb;hb=2bb86211292f416cd584023feb23dc3b86bc1761;hp=a8832032788662107f74975e006467d13b4fe768;hpb=d8b96c598c7cc488518c5b63907899400a789d56;p=lyx.git diff --git a/src/lastfiles.C b/src/lastfiles.C index a883203278..537d611c61 100644 --- a/src/lastfiles.C +++ b/src/lastfiles.C @@ -1,30 +1,35 @@ -/* This file is part of - * ====================================================== - * - * LyX, The Document Processor - * - * Copyright 1995 Matthias Ettrich - * Copyright 1995-1999 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 +#include "lastfiles.h" +#include "debug.h" -#ifdef __GNUG__ -#pragma implementation -#endif +#include +#include #include -using std::ifstream; -using std::ofstream; +#include -#include +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::ostream_iterator; -#include "support/FileInfo.h" -#include "lastfiles.h" -#include "debug.h" LastFiles::LastFiles(string const & filename, bool st, unsigned int num) : dostat(st) @@ -53,14 +58,10 @@ void LastFiles::readFile(string const & filename) // 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); } } @@ -70,23 +71,8 @@ void LastFiles::writeFile(string const & filename) const { ofstream ofs(filename.c_str()); if (ofs) { -#if 0 - for (Files::const_iterator cit = files.begin(); - cit != files.end(); - ++cit) { - ofs << (*cit) << '\n'; - } -#else - // Ok, ok. It is not required to do it this way...but it - // is kindo nice and shows the versiality of iterators and - // algorithms. I'll leave this in, and if I get reports - // about compilations errors I take it out again before - // 1.1.4. (Lgb) - using std::copy; - using std::ostream_iterator; copy(files.begin(), files.end(), ostream_iterator(ofs, "\n")); -#endif } else lyxerr << "LyX: Warning: unable to save LastFiles: " << filename << endl; @@ -105,7 +91,7 @@ void LastFiles::newFile(string const & file) } -string LastFiles::operator[](unsigned int i) const +string const LastFiles::operator[](unsigned int i) const { if (i < files.size()) return files[i];