summaryrefslogtreecommitdiff
path: root/legacy
diff options
context:
space:
mode:
authorSebastian Dransfeld <sd@tango.flipp.net>2010-03-03 12:29:09 +0000
committerSebastian Dransfeld <sd@tango.flipp.net>2010-03-03 12:29:09 +0000
commitafb2a67c5083e86188ed1894a6a7cbab283c7c5f (patch)
treeb178ad4e4666e2a8ce449ec9cb46da923e1f71d4 /legacy
parent755e118e2c06df2696fed5f2253aed1de5c2a62a (diff)
Create func to get name for cache dirs file
SVN revision: 46834
Diffstat (limited to 'legacy')
-rw-r--r--legacy/efreet/src/lib/efreet_desktop.c21
-rw-r--r--legacy/efreet/src/lib/efreet_private.h1
2 files changed, 20 insertions, 2 deletions
diff --git a/legacy/efreet/src/lib/efreet_desktop.c b/legacy/efreet/src/lib/efreet_desktop.c
index a9796604fb..57baac06fd 100644
--- a/legacy/efreet/src/lib/efreet_desktop.c
+++ b/legacy/efreet/src/lib/efreet_desktop.c
@@ -59,6 +59,7 @@ static int efreet_desktop_command_file_id = 0;
59static Ecore_Job *efreet_desktop_job = NULL; 59static Ecore_Job *efreet_desktop_job = NULL;
60 60
61static char *cache_file = NULL; 61static char *cache_file = NULL;
62static char *cache_dirs = NULL;
62static Eet_File *cache = NULL; 63static Eet_File *cache = NULL;
63static Eet_Data_Descriptor *desktop_edd = NULL; 64static Eet_Data_Descriptor *desktop_edd = NULL;
64 65
@@ -232,6 +233,7 @@ efreet_desktop_shutdown(void)
232 ecore_file_shutdown(); 233 ecore_file_shutdown();
233 eina_log_domain_unregister(_efreet_desktop_log_dom); 234 eina_log_domain_unregister(_efreet_desktop_log_dom);
234 IF_FREE(cache_file); 235 IF_FREE(cache_file);
236 IF_FREE(cache_dirs);
235 if (efreet_desktop_job) ecore_job_del(efreet_desktop_job); 237 if (efreet_desktop_job) ecore_job_del(efreet_desktop_job);
236 efreet_desktop_job = NULL; 238 efreet_desktop_job = NULL;
237} 239}
@@ -265,6 +267,22 @@ efreet_desktop_cache_file(void)
265 return cache_file; 267 return cache_file;
266} 268}
267 269
270/*
271 * Needs EAPI because of helper binaries
272 */
273EAPI const char *
274efreet_desktop_cache_dirs(void)
275{
276 char tmp[PATH_MAX] = { '\0' };
277
278 if (cache_dirs) return cache_dirs;
279
280 snprintf(tmp, sizeof(tmp), "%s/.efreet/desktop_dirs.cache", efreet_home_dir_get());
281
282 cache_dirs = strdup(tmp);
283 return cache_dirs;
284}
285
268/** 286/**
269 * @internal 287 * @internal
270 * @param desktop: The desktop to check 288 * @param desktop: The desktop to check
@@ -2064,8 +2082,7 @@ efreet_desktop_update_cache_dirs(void *data __UNUSED__)
2064 /* TODO: Retry update cache later */ 2082 /* TODO: Retry update cache later */
2065 if (flock(fd, LOCK_EX | LOCK_NB) < 0) goto error; 2083 if (flock(fd, LOCK_EX | LOCK_NB) < 0) goto error;
2066 2084
2067 snprintf(file, sizeof(file), "%s/.efreet/desktop_dirs.cache", efreet_home_dir_get()); 2085 cachefd = open(efreet_desktop_cache_dirs(), O_CREAT | O_APPEND | O_RDWR, S_IRUSR | S_IWUSR);
2068 cachefd = open(file, O_CREAT | O_APPEND | O_RDWR, S_IRUSR | S_IWUSR);
2069 if (cachefd < 0) goto error; 2086 if (cachefd < 0) goto error;
2070 if (fstat(cachefd, &st) < 0) goto error; 2087 if (fstat(cachefd, &st) < 0) goto error;
2071 if (st.st_size > 0) 2088 if (st.st_size > 0)
diff --git a/legacy/efreet/src/lib/efreet_private.h b/legacy/efreet/src/lib/efreet_private.h
index 13060f9fae..fd773f9225 100644
--- a/legacy/efreet/src/lib/efreet_private.h
+++ b/legacy/efreet/src/lib/efreet_private.h
@@ -204,6 +204,7 @@ EAPI void efreet_desktop_edd_shutdown(Eet_Data_Descriptor *edd);
204 204
205EAPI const char *efreet_desktop_util_cache_file(void); 205EAPI const char *efreet_desktop_util_cache_file(void);
206EAPI const char *efreet_desktop_cache_file(void); 206EAPI const char *efreet_desktop_cache_file(void);
207EAPI const char *efreet_desktop_cache_dirs(void);
207 208
208#define NON_EXISTING (void *)-1 209#define NON_EXISTING (void *)-1
209 210