globals: Change default file name to use pid as identifier

Summary: Change default file name to use pid as identifier

Reviewers: Hermet

Reviewed By: Hermet

Differential Revision: https://phab.enlightenment.org/D1394
This commit is contained in:
Jaehyun Cho 2014-09-11 15:43:26 +09:00 committed by ChunEon Park
parent 0447a026cc
commit 1d6ef8c9ac
4 changed files with 8 additions and 6 deletions

View File

@ -1,5 +1,5 @@
#include <Elementary.h> #include <Elementary.h>
#include "common.h" #include "common.h"
const char *DEFAULT_EDC_PATH = "/tmp/enventor.edc"; const char *DEFAULT_EDC_PATH_FORMAT = "/tmp/enventor_%d.edc";
char EDJE_PATH[PATH_MAX]; char EDJE_PATH[PATH_MAX];

View File

@ -487,7 +487,7 @@ args_dispatch(int argc, char **argv, char *edc_path, char *img_path,
} }
defaults: defaults:
if (default_edc) sprintf(edc_path, "%s", DEFAULT_EDC_PATH); if (default_edc) sprintf(edc_path, DEFAULT_EDC_PATH_FORMAT, getpid());
} }
static void static void

View File

@ -28,17 +28,19 @@ newfile_set(edit_data *ed)
Eina_Bool success = EINA_TRUE; Eina_Bool success = EINA_TRUE;
char buf[PATH_MAX]; char buf[PATH_MAX];
char default_path[PATH_MAX];
snprintf(buf, sizeof(buf), "%s/templates/%s.edc", snprintf(buf, sizeof(buf), "%s/templates/%s.edc",
elm_app_data_dir_get(), elm_object_item_text_get(it)); elm_app_data_dir_get(), elm_object_item_text_get(it));
config_edc_path_set(DEFAULT_EDC_PATH); sprintf(default_path, DEFAULT_EDC_PATH_FORMAT, getpid());
success = eina_file_copy(buf, config_edc_path_get(), success = eina_file_copy(buf, default_path,
EINA_FILE_COPY_DATA, NULL, NULL); EINA_FILE_COPY_DATA, NULL, NULL);
if (!success) if (!success)
{ {
EINA_LOG_ERR("Cannot find file! \"%s\"", buf); EINA_LOG_ERR("Cannot find file! \"%s\"", buf);
return; return;
} }
edit_edc_reload(ed, DEFAULT_EDC_PATH); edit_edc_reload(ed, default_path);
} }
void void

View File

@ -1,2 +1,2 @@
extern const char *DEFAULT_EDC_PATH; extern const char *DEFAULT_EDC_PATH_FORMAT;
extern char EDJE_PATH[PATH_MAX]; extern char EDJE_PATH[PATH_MAX];