]> git.lyx.org Git - lyx.git/blobdiff - src/lastfiles.C
Rearrange GTK icon lookup code, get rid of comboBoxTextSet
[lyx.git] / src / lastfiles.C
index 5076e40a7f78259442de1dada48bad9be011a995..537d611c619938840edd0850f16e007064b24efb 100644 (file)
@@ -1,29 +1,34 @@
-/* This file is part of
- * ====================================================== 
- * 
- *           LyX, The Document Processor
- *      
- *           Copyright 1995 Matthias Ettrich
- *           Copyright 1995-2001 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::getline;
+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;
 
 
 LastFiles::LastFiles(string const & filename, bool st, unsigned int num)
@@ -51,16 +56,12 @@ void LastFiles::readFile(string const & filename)
 {
        // we will not complain if we can't find filename nor will
        // we issue a warning. (Lgb)
-       std::ifstream ifs(filename.c_str());
+       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);
        }
 }
@@ -68,10 +69,10 @@ void LastFiles::readFile(string const & filename)
 
 void LastFiles::writeFile(string const & filename) const
 {
-       std::ofstream ofs(filename.c_str());
+       ofstream ofs(filename.c_str());
        if (ofs) {
-               std::copy(files.begin(), files.end(),
-                         std::ostream_iterator<string>(ofs, "\n"));
+               copy(files.begin(), files.end(),
+                    ostream_iterator<string>(ofs, "\n"));
        } else
                lyxerr << "LyX: Warning: unable to save LastFiles: "
                       << filename << endl;
@@ -81,7 +82,7 @@ void LastFiles::writeFile(string const & filename) const
 void LastFiles::newFile(string const & file)
 {
        // If file already exist, delete it and reinsert at front.
-       Files::iterator it = std::find(files.begin(), files.end(), file);
+       Files::iterator it = find(files.begin(), files.end(), file);
        if (it != files.end())
                files.erase(it);
        files.push_front(file);