/* */ #include "SessionSerializer.h" #include #include #include "RequestGroupMan.h" #include "a2functional.h" #include "File.h" #include "A2STR.h" #include "download_helper.h" #include "Option.h" #include "DownloadResult.h" #include "FileEntry.h" #include "prefs.h" #include "util.h" #include "array_fun.h" #include "BufferedFile.h" #include "OptionParser.h" #include "OptionHandler.h" namespace aria2 { SessionSerializer::SessionSerializer (const SharedHandle& requestGroupMan): rgman_(requestGroupMan), saveError_(true), saveInProgress_(true), saveWaiting_(true) {} bool SessionSerializer::save(const std::string& filename) const { std::string tempFilename = strconcat(filename, "__temp"); { BufferedFile fp(tempFilename, BufferedFile::WRITE); if(!fp) { return false; } if(!save(fp) || fp.close() == EOF) { return false; } } return File(tempFilename).renameTo(filename); } namespace { bool writeOption(BufferedFile& fp, const SharedHandle