static Ecore_Job *efreet_desktop_job = NULL;
static char *cache_file = NULL;
+static char *cache_dirs = NULL;
static Eet_File *cache = NULL;
static Eet_Data_Descriptor *desktop_edd = NULL;
ecore_file_shutdown();
eina_log_domain_unregister(_efreet_desktop_log_dom);
IF_FREE(cache_file);
+ IF_FREE(cache_dirs);
if (efreet_desktop_job) ecore_job_del(efreet_desktop_job);
efreet_desktop_job = NULL;
}
return cache_file;
}
+/*
+ * Needs EAPI because of helper binaries
+ */
+EAPI const char *
+efreet_desktop_cache_dirs(void)
+{
+ char tmp[PATH_MAX] = { '\0' };
+
+ if (cache_dirs) return cache_dirs;
+
+ snprintf(tmp, sizeof(tmp), "%s/.efreet/desktop_dirs.cache", efreet_home_dir_get());
+
+ cache_dirs = strdup(tmp);
+ return cache_dirs;
+}
+
/**
* @internal
* @param desktop: The desktop to check
/* TODO: Retry update cache later */
if (flock(fd, LOCK_EX | LOCK_NB) < 0) goto error;
- snprintf(file, sizeof(file), "%s/.efreet/desktop_dirs.cache", efreet_home_dir_get());
- cachefd = open(file, O_CREAT | O_APPEND | O_RDWR, S_IRUSR | S_IWUSR);
+ cachefd = open(efreet_desktop_cache_dirs(), O_CREAT | O_APPEND | O_RDWR, S_IRUSR | S_IWUSR);
if (cachefd < 0) goto error;
if (fstat(cachefd, &st) < 0) goto error;
if (st.st_size > 0)