X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FSession.cpp;h=9291ef1c2213bfcd974a4a992544446915bee8fe;hb=51ac7d895cc7a9c4ad91131d0b4734395366d04b;hp=839ec38ada5a94e7892cfa5c5db1de66753d21c8;hpb=9d0ea8aeff32833a90b3fe64df0c5518a9e241be;p=lyx.git diff --git a/src/Session.cpp b/src/Session.cpp index 839ec38ada..9291ef1c22 100644 --- a/src/Session.cpp +++ b/src/Session.cpp @@ -12,32 +12,18 @@ #include #include "Session.h" + #include "support/debug.h" -#include "support/Package.h" #include "support/filetools.h" +#include "support/Package.h" #include #include #include #include -using lyx::support::absolutePath; -using lyx::support::addName; -using lyx::support::FileName; -using lyx::support::package; - -using std::vector; -using std::getline; -using std::string; -using std::ifstream; -using std::ofstream; -using std::istream; -using std::ostream; -using std::endl; -using std::istringstream; -using std::copy; -using std::find; -using std::ostream_iterator; +using namespace std; +using namespace lyx::support; namespace { @@ -53,6 +39,7 @@ string const sec_toolbars = "[toolbars]"; namespace lyx { + LastFilesSection::LastFilesSection(unsigned int num) : default_num_last_files(4), absolute_max_last_files(100) @@ -69,11 +56,11 @@ void LastFilesSection::read(istream & is) if (c == '[') break; getline(is, tmp); - if (tmp == "" || tmp[0] == '#' || tmp[0] == ' ' || !absolutePath(tmp)) + FileName const file(tmp); + if (tmp == "" || tmp[0] == '#' || tmp[0] == ' ' || !file.isAbsolute()) continue; // read lastfiles - FileName const file(tmp); if (file.exists() && !file.isDirectory() && lastfiles.size() < num_lastfiles) lastfiles.push_back(file); @@ -123,10 +110,10 @@ void LastOpenedSection::read(istream & is) if (c == '[') break; getline(is, tmp); - if (tmp == "" || tmp[0] == '#' || tmp[0] == ' ' || !absolutePath(tmp)) + FileName const file(tmp); + if (tmp == "" || tmp[0] == '#' || tmp[0] == ' ' || !file.isAbsolute()) continue; - FileName const file(tmp); if (file.exists() && !file.isDirectory()) lastopened.push_back(file); else @@ -177,9 +164,9 @@ void LastFilePosSection::read(istream & is) itmp >> filepos.pos; itmp.ignore(2); // ignore ", " getline(itmp, fname); - if (!absolutePath(fname)) - continue; FileName const file(fname); + if (!file.isAbsolute()) + continue; if (file.exists() && !file.isDirectory() && lastfilepos.size() < num_lastfilepos) lastfilepos[file] = filepos; @@ -254,9 +241,9 @@ void BookmarksSection::read(istream & is) itmp >> pos; itmp.ignore(2); // ignore ", " getline(itmp, fname); - if (!absolutePath(fname)) - continue; FileName const file(fname); + if (!file.isAbsolute()) + continue; // only load valid bookmarks if (file.exists() && !file.isDirectory() && idx <= max_bookmarks) bookmarks[idx] = Bookmark(file, pit, pos, 0, 0); @@ -340,7 +327,7 @@ void ToolbarSection::read(istream & is) } } while (is.good()); // sort the toolbars by location, line and position - std::sort(toolbars.begin(), toolbars.end()); + sort(toolbars.begin(), toolbars.end()); }