OSDN Git Service

Idx file path is created by bbs detail.
authorAiwota Programmer <aiwotaprog@tetteke.tk>
Tue, 30 Jun 2009 11:13:43 +0000 (20:13 +0900)
committerAiwota Programmer <aiwotaprog@tetteke.tk>
Tue, 30 Jun 2009 11:13:43 +0000 (20:13 +0900)
src/bbs_detail_base.cxx
src/thread_idx.cxx

index feada1e..08c9930 100644 (file)
@@ -94,7 +94,8 @@ std::string Base::get_thread_file_path() const {
 
 std::string Base::get_thread_idx_path() const {
   const boost::filesystem::path dir(get_board_idx_dir_path());
-  const boost::filesystem::path xml = dir / (thread_ + ".xml");
+  const boost::filesystem::path xml =
+    dir / thread_.substr(0, 3) / (thread_ + ".xml");
   return xml.file_string();
 }
 
index d9f09c8..efc9c9e 100644 (file)
@@ -37,11 +37,7 @@ namespace dialektos {
 ThreadIdx::ThreadIdx() : title_(), line_count_(0), last_modified_(), etag_()
 {}
 
-void ThreadIdx::to_xml(const boost::filesystem::path& _xml) {
-  const std::string prefix = _xml.filename().substr(0, 3);
-  const boost::filesystem::path xml =
-    _xml.parent_path() / prefix / _xml.filename();
-
+void ThreadIdx::to_xml(const boost::filesystem::path& xml) {
   if (!misc::create_directories(xml.parent_path())) return;
   std::ofstream ofs(xml.file_string().c_str());
   try {
@@ -53,13 +49,9 @@ void ThreadIdx::to_xml(const boost::filesystem::path& _xml) {
   ofs.close();
 }
 
-ThreadIdx ThreadIdx::from_xml(const boost::filesystem::path& _xml) {
+ThreadIdx ThreadIdx::from_xml(const boost::filesystem::path& xml) {
   ThreadIdx idx;
 
-  const std::string prefix = _xml.filename().substr(0, 3);
-  const boost::filesystem::path xml =
-    _xml.parent_path() / prefix / _xml.filename();
-
   if (!boost::filesystem::exists(xml) ||
       !boost::filesystem::is_regular_file(xml))
     return idx;