aboutsummaryrefslogtreecommitdiff
path: root/src/Cache.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Cache.cpp')
-rw-r--r--src/Cache.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/Cache.cpp b/src/Cache.cpp
index fe377e8..0610a18 100644
--- a/src/Cache.cpp
+++ b/src/Cache.cpp
@@ -63,6 +63,13 @@ namespace dchat
return dchatHomeDir;
}
+ boost::filesystem::path Cache::getImagesDir()
+ {
+ boost::filesystem::path imagesDir = getDchatDir() / "images";
+ boost::filesystem::create_directories(imagesDir);
+ return imagesDir;
+ }
+
void Cache::loadBindsFromFile()
{
StringView fileContent;
@@ -157,7 +164,7 @@ namespace dchat
bool failed = exitStatus != 0;
if(!failed)
{
- boost::filesystem::path filepath = getDchatDir();
+ boost::filesystem::path filepath = getImagesDir();
odhtdb::Hash urlHash(it->url.data(), it->url.size());
filepath /= urlHash.toString();
@@ -209,7 +216,7 @@ namespace dchat
return it->second;
// TODO: Verify hashed url is not too long for filepath on windows
- boost::filesystem::path filepath = getDchatDir();
+ boost::filesystem::path filepath = getImagesDir();
odhtdb::Hash urlHash(url.data(), url.size());
filepath /= urlHash.toString();