- ofstream ofs(session_file.c_str());
- if (ofs) {
- ofs << "## Automatically generated lyx session file \n"
- << "## Editing this file manually may cause lyx to crash.\n";
- // first section
- ofs << '\n' << sec_lastfiles << '\n';
- copy(lastfiles.begin(), lastfiles.end(),
- ostream_iterator<string>(ofs, "\n"));
- // second section
- ofs << '\n' << sec_lastfilepos << '\n';
- for (FilePosMap::const_iterator file = lastfilepos.begin();
- file != lastfilepos.end(); ++file) {
- ofs << file->second.get<0>() << ", "
- << file->second.get<1>() << ", "
- << file->first << '\n';
- }
- // third section
- ofs << '\n' << sec_lastopened << '\n';
- copy(lastopened.begin(), lastopened.end(),
- ostream_iterator<string>(ofs, "\n"));
- // fourth section
- ofs << '\n' << sec_bookmarks << '\n';
- 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<3>() << ", "
- << bm->get<1>() << '\n';
- }
- // fifth section
- ofs << '\n' << sec_session << '\n';
- for (MiscInfo::const_iterator val = sessioninfo.begin();
- val != sessioninfo.end(); ++val) {
- ofs << val->first << " = " << val->second << '\n';