mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Changes to make retroshare-nogui able to access file listings.
- made findDirectory() more liberal. - use PeerId for name of FileIndex. git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-rpc-b1@6280 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
350ab5fd94
commit
c1f6bcd765
@ -50,6 +50,8 @@ static const char FILE_CACHE_SEPARATOR_CHAR = '|' ;
|
|||||||
* #define FI_DEBUG_ALL 1
|
* #define FI_DEBUG_ALL 1
|
||||||
****/
|
****/
|
||||||
|
|
||||||
|
#define FI_DEBUG 1
|
||||||
|
|
||||||
static RsMutex FIndexPtrMtx("FIndexPtrMtx") ;
|
static RsMutex FIndexPtrMtx("FIndexPtrMtx") ;
|
||||||
std::tr1::unordered_set<void*> FileIndex::_pointers ;
|
std::tr1::unordered_set<void*> FileIndex::_pointers ;
|
||||||
|
|
||||||
@ -350,7 +352,14 @@ DirEntry *DirEntry::findDirectory(const std::string& fpath)
|
|||||||
return it->second;
|
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
|
#ifdef FI_DEBUG
|
||||||
std::cerr << "FileIndex::loadIndex expected hash does not match" << std::endl;
|
std::cerr << "FileIndex::loadIndex expected hash does not match" << std::endl;
|
||||||
std::cerr << "Expected hash: " << expectedHash << 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
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -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
|
// 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.
|
// at next restart.
|
||||||
//
|
//
|
||||||
peerState ps;
|
|
||||||
mPeerMgr->getFriendNetStatus(data.pid, ps);
|
//peerState ps;
|
||||||
std::string peername = ps.name + " (" + ps.location + ")";
|
//mPeerMgr->getFriendNetStatus(data.pid, ps);
|
||||||
|
//std::string peername = ps.name + " (" + ps.location + ")";
|
||||||
|
|
||||||
if (finew->loadIndex(data.path + '/' + data.name, data.hash, data.size))
|
if (finew->loadIndex(data.path + '/' + data.name, data.hash, data.size))
|
||||||
{
|
{
|
||||||
#ifdef FIS_DEBUG2
|
#ifdef FIS_DEBUG2
|
||||||
std::cerr << "FileIndexStore::loadCache() Succeeded!" << std::endl;
|
std::cerr << "FileIndexStore::loadCache() Succeeded!" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
/* set the name */
|
/* This is not the place to set the peername.
|
||||||
finew->root->name = peername; // data.pid; // HACK HERE TODO XXX. name;
|
* 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)
|
if (local)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user