aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2022-04-01 15:13:36 +0200
committerGitHub <noreply@github.com>2022-04-01 15:13:36 +0200
commitcef0c5e927d51afaf89c308749602e68deb91afb (patch)
tree1f7ae216d0a88cd7d3bdcd47d5cd860af704b2b1
parentaf6a9df79b348ce47a288dee259eb0a83399b9ea (diff)
parent7da2e6d9f38fb7d915a635d315a0899ffb224848 (diff)
downloadprofani-tty-cef0c5e927d51afaf89c308749602e68deb91afb.tar.gz
Merge pull request #1673 from profanity-im/fix-logging
Fix logging (this time for real)
-rw-r--r--src/log.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/log.c b/src/log.c
index 428e1a10..1f6eaa9d 100644
--- a/src/log.c
+++ b/src/log.c
@@ -680,8 +680,14 @@ _get_log_filename(const char* const other, const char* const login, GDateTime* d
gchar* chatlogs_dir = files_file_in_account_data_path(DIR_CHATLOGS, login, is_room ? "rooms" : NULL);
gchar* logfile_name = g_date_time_format(dt, "%Y_%m_%d.log");
gchar* other_ = str_replace(other, "@", "_at_");
- gchar* logfile_path = g_strdup_printf("%s/%s/%s", chatlogs_dir, other_, logfile_name);
+ gchar* logs_path = g_strdup_printf("%s/%s", chatlogs_dir, other_);
+ gchar* logfile_path = NULL;
+ if (create_dir(logs_path)) {
+ logfile_path = g_strdup_printf("%s/%s", logs_path, logfile_name);
+ }
+
+ g_free(logs_path);
g_free(other_);
g_free(logfile_name);
g_free(chatlogs_dir);