Create folder for save file if it does not exist.

This commit is contained in:
Håvard Pettersson 2014-09-13 12:40:53 +02:00
parent b4c45dc155
commit c6818f812f

View File

@ -68,6 +68,11 @@ tox_weechat_save_identity_data_file(struct t_tox_weechat_identity *identity)
{
char *full_path = tox_weechat_identity_data_file_path(identity);
char *rightmost_slash = strrchr(full_path, '/');
char *save_dir = strndup(full_path, rightmost_slash - full_path);
weechat_mkdir_parents(save_dir, 0755);
free(save_dir);
// save Tox data to a buffer
uint32_t size = tox_size(identity->tox);
uint8_t *data = malloc(sizeof(*data) * size);