diff options
Diffstat (limited to 'src/Cache.cpp')
-rw-r--r-- | src/Cache.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/Cache.cpp b/src/Cache.cpp index c795595..0b4bfbf 100644 --- a/src/Cache.cpp +++ b/src/Cache.cpp @@ -196,6 +196,10 @@ namespace dchat int exitStatus; if(it->process->try_get_exit_status(exitStatus)) { + boost::filesystem::path filepath = getImagesDir(); + odhtdb::Hash urlHash(it->url.data(), it->url.size()); + filepath /= urlHash.toString(); + ContentByUrlResult contentByUrlResult; bool failed = exitStatus != 0; if(failed) @@ -204,10 +208,6 @@ namespace dchat } else { - boost::filesystem::path filepath = getImagesDir(); - odhtdb::Hash urlHash(it->url.data(), it->url.size()); - filepath /= urlHash.toString(); - contentByUrlResult = loadImageFromFile(filepath); if(contentByUrlResult.type == ContentByUrlResult::Type::CACHED) { @@ -217,7 +217,7 @@ namespace dchat imageDownloadMutex.lock(); contentUrlCache[it->url] = contentByUrlResult; - boost::filesystem::path downloadingFilepath = getImagesDir() / ".downloading"; + boost::filesystem::path downloadingFilepath = filepath / ".downloading"; // Intentionally ignore failure, program should not crash if we fail to remove these files... boost::system::error_code err; boost::filesystem::remove(downloadingFilepath, err); @@ -277,7 +277,7 @@ namespace dchat odhtdb::Hash urlHash(url.data(), url.size()); filepath /= urlHash.toString(); - boost::filesystem::path downloadingFilepath = getImagesDir() / ".downloading"; + boost::filesystem::path downloadingFilepath = filepath / ".downloading"; if(boost::filesystem::exists(downloadingFilepath)) { // Intentionally ignore failure, program should not crash if we fail to remove these files... |