From 66b9f42835fb319f71cbf818722e29459ceee1f4 Mon Sep 17 00:00:00 2001 From: drbob Date: Sun, 26 Jun 2011 21:43:49 +0000 Subject: [PATCH] Added Check for the existance of each Cache File before that are passed on the loader. This should once and for-all remove the copy file warnings - I hope ;) git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4343 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- libretroshare/src/dbase/cachestrapper.cc | 44 ++++++++++++++++++------ 1 file changed, 34 insertions(+), 10 deletions(-) diff --git a/libretroshare/src/dbase/cachestrapper.cc b/libretroshare/src/dbase/cachestrapper.cc index 8ee9ff611..729f62fd4 100644 --- a/libretroshare/src/dbase/cachestrapper.cc +++ b/libretroshare/src/dbase/cachestrapper.cc @@ -918,24 +918,48 @@ bool CacheStrapper::loadList(std::list& load) } else { - if (cd.pid == ownId) - { - /* load local */ - (it2 -> second).source -> loadLocalCache(cd); + /* check that the file exists first.... */ + std::string filename = cd.path; + filename += "/"; + filename += cd.name; #ifdef CS_DEBUG - std::cerr << "CacheStrapper::loadList() loaded Local"; + std::cerr << "CacheStrapper::loadList() Checking File: " << filename; + std::cerr << std::endl; +#endif + + bool fileExists = RsDirUtil::checkFile(filename); + if (fileExists) + { +#ifdef CS_DEBUG + std::cerr << "CacheStrapper::loadList() Exists ... continuing"; std::cerr << std::endl; #endif + if (cd.pid == ownId) + { + + /* load local */ + (it2 -> second).source -> loadLocalCache(cd); +#ifdef CS_DEBUG + std::cerr << "CacheStrapper::loadList() loaded Local"; + std::cerr << std::endl; +#endif + } + else + { + /* load remote */ + (it2 -> second).store -> loadCache(cd); +#ifdef CS_DEBUG + std::cerr << "CacheStrapper::loadList() loaded Remote"; + std::cerr << std::endl; +#endif + } } else { - /* load remote */ - (it2 -> second).store -> loadCache(cd); -#ifdef CS_DEBUG - std::cerr << "CacheStrapper::loadList() loaded Remote"; + std::cerr << "CacheStrapper::loadList() Doesn't Exist dropping: " << filename; std::cerr << std::endl; -#endif } + } /* cleanup */