diff options
Diffstat (limited to 'backend/job.cpp')
| -rw-r--r-- | backend/job.cpp | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/backend/job.cpp b/backend/job.cpp index 68a2090..330e492 100644 --- a/backend/job.cpp +++ b/backend/job.cpp @@ -16,6 +16,7 @@ module; #include <glib/gstdio.h> #include <sqlite3.h> #include <forward_list> +#include <boost/filesystem.hpp> export module katja.job; @@ -669,7 +670,8 @@ void pk_backend_update_packages(JobData *job_data, char **package_ids) void pk_backend_refresh_cache(JobData *job_data, bool force) { - char *tmp_dir_name, *db_err, *path = nullptr; + char *db_err, *path = nullptr; + std::filesystem::path tmp_dir_name; int ret; std::forward_list<katja::cache_entry> file_list; GFile *db_file = nullptr; @@ -678,13 +680,8 @@ void pk_backend_refresh_cache(JobData *job_data, bool force) sqlite3_stmt *stmt = nullptr; /* Create temporary directory */ - tmp_dir_name = g_dir_make_tmp("katja.XXXXXX", &err); - if (!tmp_dir_name) - { - std::cerr << err->message << std::endl; - g_error_free(err); - return; - } + tmp_dir_name = std::filesystem::temp_directory_path() / boost::filesystem::unique_path("katja.%%%%%%").native(); + std::filesystem::create_directories(tmp_dir_name); /* Force the complete cache refresh if the read configuration file is newer than the metadata cache */ if (!force) @@ -754,7 +751,5 @@ out: g_free(path); std::filesystem::remove_all(tmp_dir_name); - g_rmdir(tmp_dir_name); - g_free(tmp_dir_name); } } |
