summaryrefslogtreecommitdiff
path: root/src/discord/store.cpp
diff options
context:
space:
mode:
authorouwou <26526779+ouwou@users.noreply.github.com>2025-02-28 01:43:47 -0500
committerouwou <26526779+ouwou@users.noreply.github.com>2025-02-28 01:43:47 -0500
commitba15622a751b8e67b8b62d512ad713bc408f090d (patch)
treee95173c3bc59e4e16fe42511b9cc1fd521661642 /src/discord/store.cpp
parenta7d1d6b3d9de726d303e3c98c8b43441faa1e060 (diff)
downloadabaddon-portaudio-ba15622a751b8e67b8b62d512ad713bc408f090d.tar.gz
abaddon-portaudio-ba15622a751b8e67b8b62d512ad713bc408f090d.zip
try and resolve file name conflicts
Diffstat (limited to 'src/discord/store.cpp')
-rw-r--r--src/discord/store.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/discord/store.cpp b/src/discord/store.cpp
index 4de5d63..506b860 100644
--- a/src/discord/store.cpp
+++ b/src/discord/store.cpp
@@ -3,10 +3,19 @@
using namespace std::literals::string_literals;
-// hopefully the casting between signed and unsigned int64 doesnt cause issues
+static std::filesystem::path MakeDBPath(bool mem_store) {
+ if (mem_store) {
+ return ":memory:";
+ } else {
+ gchar *rand = g_uuid_string_random();
+ std::string randstr = rand;
+ g_free(rand);
+ return std::filesystem::temp_directory_path() / ("abaddon-store-"s + randstr + ".db"s);
+ }
+}
Store::Store(bool mem_store)
- : m_db_path(mem_store ? ":memory:" : std::filesystem::temp_directory_path() / "abaddon-store.db")
+ : m_db_path(MakeDBPath(mem_store))
, m_db(m_db_path.string().c_str()) {
if (!m_db.OK()) {
fprintf(stderr, "error opening database: %s\n", m_db.ErrStr());