diff options
author | ouwou <26526779+ouwou@users.noreply.github.com> | 2025-06-03 23:18:32 -0400 |
---|---|---|
committer | ouwou <26526779+ouwou@users.noreply.github.com> | 2025-06-03 23:18:32 -0400 |
commit | 082e910fb6570e2e7972d16b8728f9400077ac11 (patch) | |
tree | e932aab83e5f2c7101ac093ef2e9a0fd9a83afc6 | |
parent | 4c79ae6a69ee42cfa4892aae3e105b404b9a29c1 (diff) | |
download | abaddon-portaudio-082e910fb6570e2e7972d16b8728f9400077ac11.tar.gz abaddon-portaudio-082e910fb6570e2e7972d16b8728f9400077ac11.zip |
fix image pasting
-rw-r--r-- | src/components/chatinput.cpp | 3 | ||||
-rw-r--r-- | src/filecache.cpp | 3 | ||||
-rw-r--r-- | src/filecache.hpp | 1 |
3 files changed, 6 insertions, 1 deletions
diff --git a/src/components/chatinput.cpp b/src/components/chatinput.cpp index 1fcf628..0590379 100644 --- a/src/components/chatinput.cpp +++ b/src/components/chatinput.cpp @@ -204,7 +204,8 @@ bool ChatInputAttachmentContainer::AddImage(const Glib::RefPtr<Gdk::Pixbuf> &pb) static unsigned go_up = 0; std::string dest_name = "pasted-image-" + std::to_string(go_up++); - const auto path = (std::filesystem::temp_directory_path() / "abaddon-cache" / dest_name).string(); + const auto cache_path = Abaddon::Get().GetImageManager().GetCache().GetCachePath(); + const auto path = (cache_path / dest_name).string(); try { pb->save(path, "png"); diff --git a/src/filecache.cpp b/src/filecache.cpp index 66787e1..94b952d 100644 --- a/src/filecache.cpp +++ b/src/filecache.cpp @@ -40,6 +40,9 @@ void Cache::ClearCache() { for (const auto &path : std::filesystem::directory_iterator(m_tmp_path)) std::filesystem::remove_all(path); } +std::filesystem::path Cache::GetCachePath() const { + return m_tmp_path; +} void Cache::RespondFromPath(const std::filesystem::path &path, const callback_type &cb) { cb(path.string()); diff --git a/src/filecache.hpp b/src/filecache.hpp index 6b6532f..79004d2 100644 --- a/src/filecache.hpp +++ b/src/filecache.hpp @@ -62,6 +62,7 @@ public: void GetFileFromURL(const std::string &url, const callback_type &cb); std::string GetPathIfCached(const std::string &url); void ClearCache(); + [[nodiscard]] std::filesystem::path GetCachePath() const; private: void CleanupFutures(); |