mirror of
https://github.com/uowuo/abaddon.git
synced 2026-08-15 05:19:58 +00:00
try and resolve file name conflicts
This commit is contained in:
1 parent
a7d1d6b3d9
commit
ba15622a75
2 files changed
+15
-3
No files matched your search
+11
-2
@@ -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());
|
||||
|
||||
+4
-1
@@ -12,7 +12,10 @@ std::string GetCachedName(const std::string &str) {
|
||||
}
|
||||
|
||||
Cache::Cache() {
|
||||
m_tmp_path = std::filesystem::temp_directory_path() / "abaddon-cache";
|
||||
gchar *rand = g_uuid_string_random();
|
||||
std::string randstr = rand;
|
||||
g_free(rand);
|
||||
m_tmp_path = std::filesystem::temp_directory_path() / ("abaddon-cache-" + randstr);
|
||||
std::filesystem::create_directories(m_tmp_path);
|
||||
m_worker.set_file_path(m_tmp_path);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user