#include <algorithm>
#include <iterator>
-using lyx::support::AddName;
-using lyx::support::package;
+using lyx::support::addName;
+using lyx::support::package;
namespace fs = boost::filesystem;
setNumberOfLastFiles(num);
// locate the session file
// note that the session file name 'session' is hard-coded
- session_file = AddName(package().user_support(), "session");
+ session_file = addName(package().user_support(), "session");
//
readFile();
}
// the following is currently not implemented very
// robustly. (Manually editing of the session file may crash lyx)
- //
+ //
while (getline(ifs, tmp)) {
// Ignore comments, empty line or line stats with ' '
if (tmp == "" || tmp[0] == '#' || tmp[0] == ' ')
continue;
lastopened.push_back(tmp);
} else if (section == id_bookmarks) {
- // read bookmarks
+ // read bookmarks
// bookmarkid, id, pos, file\n
unsigned int num;
unsigned int id;
ostream_iterator<string>(ofs, "\n"));
// second section
ofs << '\n' << sec_lastfilepos << '\n';
- for (FilePosMap::const_iterator file = lastfilepos.begin();
+ for (FilePosMap::const_iterator file = lastfilepos.begin();
file != lastfilepos.end(); ++file) {
- ofs << file->second.get<0>() << ", "
+ ofs << file->second.get<0>() << ", "
<< file->second.get<1>() << ", "
<< file->first << '\n';
}
ostream_iterator<string>(ofs, "\n"));
// fourth section
ofs << '\n' << sec_bookmarks << '\n';
- for (BookmarkList::const_iterator bm = bookmarks.begin();
+ for (BookmarkList::const_iterator bm = bookmarks.begin();
bm != bookmarks.end(); ++bm) {
// save bookmark number, id, pos, fname
ofs << bm->get<0>() << ", "
- << bm->get<2>() << ", "
+ << bm->get<2>() << ", "
<< bm->get<3>() << ", "
<< bm->get<1>() << '\n';
}
if (entry != lastfilepos.end())
return entry->second;
// Not found, return the first paragraph
- else
+ else
return 0;
}
}
-void Session::setLastOpenedFiles(vector<string> const & files)
+void Session::addLastOpenedFile(string const & file)
{
- lastopened = files;
+ lastopened.push_back(file);
}