return request_json;
}
-// static void __make_temp_logs()
// Make temporary log directories and files using app_get_data_path() API
+static char *__make_temp_logs(const char *file_name)
+{
+ char *data_path = NULL;
+ char *file_path = NULL;
+ FILE *fp;
+
+ data_path = app_get_data_path();
+
+ if (!data_path)
+ return NULL;
+
+ file_path = g_strdup_printf("%s/%s", data_path, file_name);
+ free(data_path);
+
+ fp = fopen(file_path, "w");
+
+ if (!fp) {
+ free(file_path);
+ return NULL;
+ }
+
+ fputs("test", fp);
+ fclose(fp);
+
+ return file_path;
+}
static void __reboot_result_callback(idm_command_h command, idm_result_e result, idm_reason_e reason, const char *detail, void *data)
{
static Eina_Bool __command_stop(void *data)
{
app_data *ad = data;
- char log_path_arr[][3] = {
- "/TBD/",
- "/TBD/",
- NULL
- }; // The last item of this array must be NULL
- char *archive_file = "/TBD/log.zip"
+ char *data_path = app_get_data_path();
+ char *log_path_arr[3] = {NULL,}; // The last item of this array must be NULL
+ char *archive_file = NULL;
if (ad->command) {
idm_command_stop(ad->command);
}
ad->timer = NULL;
+ log_path_arr[0] = __make_temp_logs("test1.log");
+ log_path_arr[1] = __make_temp_logs("test2.log");
+
+ archive_file = g_strdup_printf("%s/%s", data_path, "log_archive.zip");
+
// Get log archive
__get_log_archive(log_path_arr, archive_file, 3, __get_log_archive_result_cb, ad);
+ g_free(log_path_arr[0]);
+ g_free(log_path_arr[1]);
+ g_free(archive_file);
+
// 3. reboot cmd 실행
__reboot(ad);