diff --git a/libretroshare/src/dbase/findex.cc b/libretroshare/src/dbase/findex.cc index 4784a80c6..c739b9e32 100644 --- a/libretroshare/src/dbase/findex.cc +++ b/libretroshare/src/dbase/findex.cc @@ -50,6 +50,8 @@ static const char FILE_CACHE_SEPARATOR_CHAR = '|' ; * #define FI_DEBUG_ALL 1 ****/ +#define FI_DEBUG 1 + static RsMutex FIndexPtrMtx("FIndexPtrMtx") ; std::tr1::unordered_set FileIndex::_pointers ; @@ -350,7 +352,14 @@ DirEntry *DirEntry::findDirectory(const std::string& fpath) return it->second; } - return (it->second)->findDirectory(rempath); + + // Adding more lenient directory look up. + // returns lower directory to fpath is a FILE. + DirEntry *subdir = (it->second)->findDirectory(rempath); + if (subdir) + return subdir; + else + return it->second; } @@ -780,7 +789,7 @@ int FileIndex::loadIndex(const std::string& filename, const std::string& expecte #ifdef FI_DEBUG std::cerr << "FileIndex::loadIndex expected hash does not match" << std::endl; std::cerr << "Expected hash: " << expectedHash << std::endl; - std::cerr << "Hash found: " << tmpout.str() << std::endl; + std::cerr << "Hash found: " << tmpout << std::endl; #endif return 0; } diff --git a/libretroshare/src/dbase/fistore.cc b/libretroshare/src/dbase/fistore.cc index 481067d08..d2aa1aeb5 100644 --- a/libretroshare/src/dbase/fistore.cc +++ b/libretroshare/src/dbase/fistore.cc @@ -90,17 +90,23 @@ int FileIndexStore::loadCache(const CacheData &data) // from the cache. Doing this, the file list still shows in a session where we deleted a friend, but will be removed // at next restart. // - peerState ps; - mPeerMgr->getFriendNetStatus(data.pid, ps); - std::string peername = ps.name + " (" + ps.location + ")"; + + //peerState ps; + //mPeerMgr->getFriendNetStatus(data.pid, ps); + //std::string peername = ps.name + " (" + ps.location + ")"; if (finew->loadIndex(data.path + '/' + data.name, data.hash, data.size)) { #ifdef FIS_DEBUG2 std::cerr << "FileIndexStore::loadCache() Succeeded!" << std::endl; #endif - /* set the name */ - finew->root->name = peername; // data.pid; // HACK HERE TODO XXX. name; + /* This is not the place to set the peername. + * It is a hack, which makes it programmatically impossible + * to get the file data out.... + * + * peername should not be used in dbase. + */ + finew->root->name = data.pid; if (local) {