2010-11-15 13:07:22 -08:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include <config.h>
|
|
|
|
#endif
|
2012-11-10 01:13:56 -08:00
|
|
|
|
2010-11-15 13:07:22 -08:00
|
|
|
#include <fcntl.h>
|
|
|
|
#include <unistd.h>
|
2012-07-04 11:35:31 -07:00
|
|
|
#include <errno.h>
|
2013-07-11 02:22:38 -07:00
|
|
|
#ifdef HAVE_SYS_RESOURCE_H
|
2013-06-20 04:53:54 -07:00
|
|
|
#include <sys/time.h>
|
|
|
|
#include <sys/resource.h>
|
2013-07-09 01:04:58 -07:00
|
|
|
#endif
|
2010-11-15 13:07:22 -08:00
|
|
|
|
2019-05-20 06:10:00 -07:00
|
|
|
#ifdef _WIN32
|
|
|
|
# include <evil_private.h> /* fcntl */
|
|
|
|
#endif
|
|
|
|
|
2010-11-15 13:07:22 -08:00
|
|
|
#include <Eina.h>
|
2010-11-28 02:05:52 -08:00
|
|
|
#include <Eet.h>
|
2010-11-15 13:07:22 -08:00
|
|
|
#include <Ecore.h>
|
|
|
|
#include <Ecore_File.h>
|
|
|
|
|
2011-03-18 12:47:57 -07:00
|
|
|
#define EFREET_MODULE_LOG_DOM _efreet_icon_cache_log_dom
|
|
|
|
static int _efreet_icon_cache_log_dom = -1;
|
2011-02-05 11:56:44 -08:00
|
|
|
|
2010-11-15 13:07:22 -08:00
|
|
|
#include "Efreet.h"
|
|
|
|
#include "efreet_private.h"
|
2010-11-27 12:15:00 -08:00
|
|
|
#include "efreet_cache_private.h"
|
2010-11-15 13:07:22 -08:00
|
|
|
|
2015-12-03 02:42:08 -08:00
|
|
|
#ifndef O_BINARY
|
|
|
|
# define O_BINARY 0
|
|
|
|
#endif
|
|
|
|
|
2011-02-02 14:58:15 -08:00
|
|
|
static Eina_Array *exts = NULL;
|
|
|
|
static Eina_Array *extra_dirs = NULL;
|
2010-11-29 05:17:33 -08:00
|
|
|
static Eina_Array *strs = NULL;
|
2010-12-08 13:39:43 -08:00
|
|
|
static Eina_Hash *icon_themes = NULL;
|
2010-11-16 02:32:21 -08:00
|
|
|
|
2010-11-29 05:17:33 -08:00
|
|
|
static Eina_Bool
|
2011-08-16 05:46:24 -07:00
|
|
|
cache_directory_modified(Eina_Hash *dirs, const char *dir)
|
2010-11-29 05:17:33 -08:00
|
|
|
{
|
efreetd - cache - add more statinfo work around 0 mtime distros
some distros 9notably in this case nixos) want to do reproducible
builds. to them this means going around setting mtime for all files to
0. this means efreetd not only thinks mtime is invalid/stupid (0 is
generally just that as midnight on jan 1 1970 is not exactly a
sensible dare for a modified timestamp of a file as no filesystem with
any sanity will have not been modified since that time), but it keeps
mtime at 0 even when things update. this totally breaks efreetd that
expects to find mtime increases over time as things change. it's
necessary because it has to perform a "are mu caches up to date" scan
of all file data it caches and it needs to know if it should rebuild
something based on this.
so this does a few things:
1. it makes mtime have to be an exact match to the cache, not cache
mtime >= file mtime. so any change forward or back is an inavlidation.
2. it now also uses ctime, mode, size, uid, gid, block count and if a
symlink, the sha1 of the symlink path in addition and any change to
these == invalid.
this adds a lot of code and changes how dirs get scanned a bit but it
means it can pick up changes on these 0 mtime distros.
interestingly the policy of mtime being 0 is to have a reprodcible fs
... but ctime still changes and is > 0, as does inode info, so it's
not actually possible to have it totally work... but they try still,
so this is a fix for that problem.
whilst i was doing thisi also noticed efreetd re-red dirs many times
due to icon theme inhritance. i also fixed that to do a LOT less
syscalls by only scanning a dir once as i was rejigging the scanning
code at the time anyway. this should optimize thr scan costs at
efreetd startup too.
@fix
@opt
2020-06-18 03:03:02 -07:00
|
|
|
Efreet_Cache_Directory *dcache;
|
|
|
|
Efreet_Cache_Check check;
|
|
|
|
|
|
|
|
if (!dirs) return EINA_TRUE;
|
|
|
|
if (!efreet_file_cache_fill(dir, &check)) return EINA_FALSE;
|
|
|
|
dcache = eina_hash_find(dirs, dir);
|
|
|
|
if (!dcache)
|
|
|
|
{
|
2010-11-30 10:41:21 -08:00
|
|
|
dcache = malloc(sizeof (Efreet_Cache_Directory));
|
2011-01-31 03:43:52 -08:00
|
|
|
if (!dcache) return EINA_TRUE;
|
efreetd - cache - add more statinfo work around 0 mtime distros
some distros 9notably in this case nixos) want to do reproducible
builds. to them this means going around setting mtime for all files to
0. this means efreetd not only thinks mtime is invalid/stupid (0 is
generally just that as midnight on jan 1 1970 is not exactly a
sensible dare for a modified timestamp of a file as no filesystem with
any sanity will have not been modified since that time), but it keeps
mtime at 0 even when things update. this totally breaks efreetd that
expects to find mtime increases over time as things change. it's
necessary because it has to perform a "are mu caches up to date" scan
of all file data it caches and it needs to know if it should rebuild
something based on this.
so this does a few things:
1. it makes mtime have to be an exact match to the cache, not cache
mtime >= file mtime. so any change forward or back is an inavlidation.
2. it now also uses ctime, mode, size, uid, gid, block count and if a
symlink, the sha1 of the symlink path in addition and any change to
these == invalid.
this adds a lot of code and changes how dirs get scanned a bit but it
means it can pick up changes on these 0 mtime distros.
interestingly the policy of mtime being 0 is to have a reprodcible fs
... but ctime still changes and is > 0, as does inode info, so it's
not actually possible to have it totally work... but they try still,
so this is a fix for that problem.
whilst i was doing thisi also noticed efreetd re-red dirs many times
due to icon theme inhritance. i also fixed that to do a LOT less
syscalls by only scanning a dir once as i was rejigging the scanning
code at the time anyway. this should optimize thr scan costs at
efreetd startup too.
@fix
@opt
2020-06-18 03:03:02 -07:00
|
|
|
dcache->check = check;
|
2010-11-30 10:41:21 -08:00
|
|
|
eina_hash_add(dirs, dir, dcache);
|
efreetd - cache - add more statinfo work around 0 mtime distros
some distros 9notably in this case nixos) want to do reproducible
builds. to them this means going around setting mtime for all files to
0. this means efreetd not only thinks mtime is invalid/stupid (0 is
generally just that as midnight on jan 1 1970 is not exactly a
sensible dare for a modified timestamp of a file as no filesystem with
any sanity will have not been modified since that time), but it keeps
mtime at 0 even when things update. this totally breaks efreetd that
expects to find mtime increases over time as things change. it's
necessary because it has to perform a "are mu caches up to date" scan
of all file data it caches and it needs to know if it should rebuild
something based on this.
so this does a few things:
1. it makes mtime have to be an exact match to the cache, not cache
mtime >= file mtime. so any change forward or back is an inavlidation.
2. it now also uses ctime, mode, size, uid, gid, block count and if a
symlink, the sha1 of the symlink path in addition and any change to
these == invalid.
this adds a lot of code and changes how dirs get scanned a bit but it
means it can pick up changes on these 0 mtime distros.
interestingly the policy of mtime being 0 is to have a reprodcible fs
... but ctime still changes and is > 0, as does inode info, so it's
not actually possible to have it totally work... but they try still,
so this is a fix for that problem.
whilst i was doing thisi also noticed efreetd re-red dirs many times
due to icon theme inhritance. i also fixed that to do a LOT less
syscalls by only scanning a dir once as i was rejigging the scanning
code at the time anyway. this should optimize thr scan costs at
efreetd startup too.
@fix
@opt
2020-06-18 03:03:02 -07:00
|
|
|
}
|
|
|
|
else if (efreet_file_cache_check(&check, &dcache->check))
|
|
|
|
return EINA_FALSE;
|
|
|
|
else
|
|
|
|
dcache->check = check;
|
|
|
|
return EINA_TRUE;
|
2010-11-29 05:17:33 -08:00
|
|
|
}
|
|
|
|
|
2010-11-26 06:56:23 -08:00
|
|
|
static Eina_Bool
|
2011-02-02 14:58:15 -08:00
|
|
|
cache_extension_lookup(const char *ext)
|
2010-11-23 08:49:46 -08:00
|
|
|
{
|
efreetd - cache - add more statinfo work around 0 mtime distros
some distros 9notably in this case nixos) want to do reproducible
builds. to them this means going around setting mtime for all files to
0. this means efreetd not only thinks mtime is invalid/stupid (0 is
generally just that as midnight on jan 1 1970 is not exactly a
sensible dare for a modified timestamp of a file as no filesystem with
any sanity will have not been modified since that time), but it keeps
mtime at 0 even when things update. this totally breaks efreetd that
expects to find mtime increases over time as things change. it's
necessary because it has to perform a "are mu caches up to date" scan
of all file data it caches and it needs to know if it should rebuild
something based on this.
so this does a few things:
1. it makes mtime have to be an exact match to the cache, not cache
mtime >= file mtime. so any change forward or back is an inavlidation.
2. it now also uses ctime, mode, size, uid, gid, block count and if a
symlink, the sha1 of the symlink path in addition and any change to
these == invalid.
this adds a lot of code and changes how dirs get scanned a bit but it
means it can pick up changes on these 0 mtime distros.
interestingly the policy of mtime being 0 is to have a reprodcible fs
... but ctime still changes and is > 0, as does inode info, so it's
not actually possible to have it totally work... but they try still,
so this is a fix for that problem.
whilst i was doing thisi also noticed efreetd re-red dirs many times
due to icon theme inhritance. i also fixed that to do a LOT less
syscalls by only scanning a dir once as i was rejigging the scanning
code at the time anyway. this should optimize thr scan costs at
efreetd startup too.
@fix
@opt
2020-06-18 03:03:02 -07:00
|
|
|
unsigned int i;
|
2010-11-26 06:56:23 -08:00
|
|
|
|
efreetd - cache - add more statinfo work around 0 mtime distros
some distros 9notably in this case nixos) want to do reproducible
builds. to them this means going around setting mtime for all files to
0. this means efreetd not only thinks mtime is invalid/stupid (0 is
generally just that as midnight on jan 1 1970 is not exactly a
sensible dare for a modified timestamp of a file as no filesystem with
any sanity will have not been modified since that time), but it keeps
mtime at 0 even when things update. this totally breaks efreetd that
expects to find mtime increases over time as things change. it's
necessary because it has to perform a "are mu caches up to date" scan
of all file data it caches and it needs to know if it should rebuild
something based on this.
so this does a few things:
1. it makes mtime have to be an exact match to the cache, not cache
mtime >= file mtime. so any change forward or back is an inavlidation.
2. it now also uses ctime, mode, size, uid, gid, block count and if a
symlink, the sha1 of the symlink path in addition and any change to
these == invalid.
this adds a lot of code and changes how dirs get scanned a bit but it
means it can pick up changes on these 0 mtime distros.
interestingly the policy of mtime being 0 is to have a reprodcible fs
... but ctime still changes and is > 0, as does inode info, so it's
not actually possible to have it totally work... but they try still,
so this is a fix for that problem.
whilst i was doing thisi also noticed efreetd re-red dirs many times
due to icon theme inhritance. i also fixed that to do a LOT less
syscalls by only scanning a dir once as i was rejigging the scanning
code at the time anyway. this should optimize thr scan costs at
efreetd startup too.
@fix
@opt
2020-06-18 03:03:02 -07:00
|
|
|
for (i = 0; i < exts->count; ++i)
|
|
|
|
{
|
|
|
|
if (!strcmp(exts->data[i], ext)) return EINA_TRUE;
|
|
|
|
}
|
|
|
|
return EINA_FALSE;
|
2010-11-23 08:49:46 -08:00
|
|
|
}
|
|
|
|
|
2010-11-26 06:56:23 -08:00
|
|
|
static Eina_Bool
|
2011-08-16 05:46:24 -07:00
|
|
|
cache_fallback_scan_dir(Eina_Hash *icons, Eina_Hash *dirs, const char *dir)
|
2010-11-16 02:32:21 -08:00
|
|
|
{
|
|
|
|
Eina_Iterator *it;
|
2010-11-26 06:56:23 -08:00
|
|
|
Eina_File_Direct_Info *entry;
|
2010-11-16 02:32:21 -08:00
|
|
|
|
2011-08-16 05:46:24 -07:00
|
|
|
if (!cache_directory_modified(dirs, dir)) return EINA_TRUE;
|
2010-11-16 02:32:21 -08:00
|
|
|
|
2010-11-26 06:56:23 -08:00
|
|
|
it = eina_file_stat_ls(dir);
|
2011-01-31 03:43:52 -08:00
|
|
|
if (!it) return EINA_TRUE;
|
2010-11-26 06:56:23 -08:00
|
|
|
|
|
|
|
EINA_ITERATOR_FOREACH(it, entry)
|
2010-11-27 12:36:27 -08:00
|
|
|
{
|
|
|
|
Efreet_Cache_Fallback_Icon *icon;
|
|
|
|
char *name;
|
|
|
|
char *ext;
|
|
|
|
unsigned int i;
|
2017-07-13 02:48:31 -07:00
|
|
|
void *p;
|
2010-11-27 12:36:27 -08:00
|
|
|
|
|
|
|
if (entry->type == EINA_FILE_DIR)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
ext = strrchr(entry->path + entry->name_start, '.');
|
2011-02-02 14:58:15 -08:00
|
|
|
if (!ext || !cache_extension_lookup(ext))
|
2010-11-27 12:36:27 -08:00
|
|
|
continue;
|
|
|
|
|
|
|
|
/* icon with known extension */
|
|
|
|
name = entry->path + entry->name_start;
|
|
|
|
*ext = '\0';
|
|
|
|
|
|
|
|
icon = eina_hash_find(icons, name);
|
|
|
|
if (!icon)
|
|
|
|
{
|
|
|
|
icon = NEW(Efreet_Cache_Fallback_Icon, 1);
|
|
|
|
icon->theme = NULL;
|
|
|
|
eina_hash_add(icons, name, icon);
|
|
|
|
}
|
|
|
|
|
|
|
|
*ext = '.';
|
|
|
|
|
|
|
|
for (i = 0; i < icon->icons_count; ++i)
|
|
|
|
if (!strcmp(icon->icons[i], entry->path))
|
|
|
|
break;
|
2010-11-26 06:56:23 -08:00
|
|
|
|
2010-11-27 12:36:27 -08:00
|
|
|
if (i != icon->icons_count)
|
2011-02-01 00:27:53 -08:00
|
|
|
continue;
|
2010-11-26 06:56:23 -08:00
|
|
|
|
2017-07-13 02:48:31 -07:00
|
|
|
p = realloc(icon->icons, sizeof (char *) * (icon->icons_count + 1));
|
|
|
|
if (!p)
|
|
|
|
{
|
|
|
|
ERR("Out of memory");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
icon->icons = p;
|
2010-11-29 05:17:33 -08:00
|
|
|
icon->icons[icon->icons_count] = eina_stringshare_add(entry->path);
|
|
|
|
eina_array_push(strs, icon->icons[icon->icons_count++]);
|
2010-11-27 12:36:27 -08:00
|
|
|
}
|
2010-11-26 06:56:23 -08:00
|
|
|
|
2010-11-16 02:32:21 -08:00
|
|
|
eina_iterator_free(it);
|
2010-11-26 06:56:23 -08:00
|
|
|
|
2011-01-31 03:43:52 -08:00
|
|
|
return EINA_TRUE;
|
2010-11-16 02:32:21 -08:00
|
|
|
}
|
|
|
|
|
2010-11-26 06:56:23 -08:00
|
|
|
static Eina_Bool
|
2011-08-16 05:46:24 -07:00
|
|
|
cache_fallback_scan(Eina_Hash *icons, Eina_Hash *dirs)
|
2010-11-16 02:32:21 -08:00
|
|
|
{
|
2011-02-02 14:58:15 -08:00
|
|
|
unsigned int i;
|
2010-11-16 02:32:21 -08:00
|
|
|
Eina_List *xdg_dirs, *l;
|
|
|
|
const char *dir;
|
|
|
|
char path[PATH_MAX];
|
2010-11-26 06:56:23 -08:00
|
|
|
|
2011-02-02 14:58:15 -08:00
|
|
|
for (i = 0; i < extra_dirs->count; i++)
|
2011-08-16 05:46:24 -07:00
|
|
|
cache_fallback_scan_dir(icons, dirs, extra_dirs->data[i]);
|
2011-02-02 14:58:15 -08:00
|
|
|
|
2011-08-16 05:46:24 -07:00
|
|
|
cache_fallback_scan_dir(icons, dirs, efreet_icon_deprecated_user_dir_get());
|
|
|
|
cache_fallback_scan_dir(icons, dirs, efreet_icon_user_dir_get());
|
2010-11-16 02:32:21 -08:00
|
|
|
|
|
|
|
xdg_dirs = efreet_data_dirs_get();
|
|
|
|
EINA_LIST_FOREACH(xdg_dirs, l, dir)
|
|
|
|
{
|
|
|
|
snprintf(path, sizeof(path), "%s/icons", dir);
|
2011-08-16 05:46:24 -07:00
|
|
|
cache_fallback_scan_dir(icons, dirs, path);
|
2010-11-16 02:32:21 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifndef STRICT_SPEC
|
|
|
|
EINA_LIST_FOREACH(xdg_dirs, l, dir)
|
|
|
|
{
|
|
|
|
snprintf(path, sizeof(path), "%s/pixmaps", dir);
|
2011-08-16 05:46:24 -07:00
|
|
|
cache_fallback_scan_dir(icons, dirs, path);
|
2010-11-16 02:32:21 -08:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2020-04-16 05:03:45 -07:00
|
|
|
cache_fallback_scan_dir(icons, dirs, "/usr/local/share/pixmaps");
|
2011-08-16 05:46:24 -07:00
|
|
|
cache_fallback_scan_dir(icons, dirs, "/usr/share/pixmaps");
|
2010-11-26 06:56:23 -08:00
|
|
|
|
2011-01-31 03:43:52 -08:00
|
|
|
return EINA_TRUE;
|
2010-11-16 02:32:21 -08:00
|
|
|
}
|
2010-11-15 13:07:22 -08:00
|
|
|
|
2011-08-16 05:46:24 -07:00
|
|
|
static Eina_Bool
|
|
|
|
check_fallback_changed(Efreet_Cache_Icon_Theme *theme)
|
|
|
|
{
|
|
|
|
unsigned int i;
|
|
|
|
Eina_List *xdg_dirs, *l;
|
|
|
|
const char *dir;
|
|
|
|
char path[PATH_MAX];
|
|
|
|
|
|
|
|
/* Check if the dirs we have cached are changed */
|
|
|
|
if (theme->dirs)
|
|
|
|
{
|
|
|
|
Eina_Iterator *it;
|
|
|
|
Eina_Bool changed = EINA_FALSE;
|
|
|
|
|
|
|
|
it = eina_hash_iterator_key_new(theme->dirs);
|
|
|
|
EINA_ITERATOR_FOREACH(it, dir)
|
|
|
|
{
|
|
|
|
changed = !ecore_file_exists(dir);
|
|
|
|
if (changed) break;
|
|
|
|
changed = cache_directory_modified(theme->dirs, dir);
|
|
|
|
if (changed) break;
|
|
|
|
}
|
|
|
|
eina_iterator_free(it);
|
|
|
|
if (changed) return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Check if spec dirs have changed */
|
|
|
|
for (i = 0; i < extra_dirs->count; i++)
|
|
|
|
if (cache_directory_modified(theme->dirs, extra_dirs->data[i])) return EINA_TRUE;
|
|
|
|
|
|
|
|
if (cache_directory_modified(theme->dirs, efreet_icon_deprecated_user_dir_get())) return EINA_TRUE;
|
|
|
|
if (cache_directory_modified(theme->dirs, efreet_icon_user_dir_get())) return EINA_TRUE;
|
|
|
|
|
|
|
|
xdg_dirs = efreet_data_dirs_get();
|
|
|
|
EINA_LIST_FOREACH(xdg_dirs, l, dir)
|
|
|
|
{
|
|
|
|
snprintf(path, sizeof(path), "%s/icons", dir);
|
|
|
|
if (cache_directory_modified(theme->dirs, path)) return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifndef STRICT_SPEC
|
|
|
|
EINA_LIST_FOREACH(xdg_dirs, l, dir)
|
|
|
|
{
|
|
|
|
snprintf(path, sizeof(path), "%s/pixmaps", dir);
|
|
|
|
if (cache_directory_modified(theme->dirs, path)) return EINA_TRUE;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2020-04-16 05:03:45 -07:00
|
|
|
if (cache_directory_modified(theme->dirs, "/usr/local/share/pixmaps")) return EINA_TRUE;
|
2011-08-16 05:46:24 -07:00
|
|
|
if (cache_directory_modified(theme->dirs, "/usr/share/pixmaps")) return EINA_TRUE;
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
efreetd - cache - add more statinfo work around 0 mtime distros
some distros 9notably in this case nixos) want to do reproducible
builds. to them this means going around setting mtime for all files to
0. this means efreetd not only thinks mtime is invalid/stupid (0 is
generally just that as midnight on jan 1 1970 is not exactly a
sensible dare for a modified timestamp of a file as no filesystem with
any sanity will have not been modified since that time), but it keeps
mtime at 0 even when things update. this totally breaks efreetd that
expects to find mtime increases over time as things change. it's
necessary because it has to perform a "are mu caches up to date" scan
of all file data it caches and it needs to know if it should rebuild
something based on this.
so this does a few things:
1. it makes mtime have to be an exact match to the cache, not cache
mtime >= file mtime. so any change forward or back is an inavlidation.
2. it now also uses ctime, mode, size, uid, gid, block count and if a
symlink, the sha1 of the symlink path in addition and any change to
these == invalid.
this adds a lot of code and changes how dirs get scanned a bit but it
means it can pick up changes on these 0 mtime distros.
interestingly the policy of mtime being 0 is to have a reprodcible fs
... but ctime still changes and is > 0, as does inode info, so it's
not actually possible to have it totally work... but they try still,
so this is a fix for that problem.
whilst i was doing thisi also noticed efreetd re-red dirs many times
due to icon theme inhritance. i also fixed that to do a LOT less
syscalls by only scanning a dir once as i was rejigging the scanning
code at the time anyway. this should optimize thr scan costs at
efreetd startup too.
@fix
@opt
2020-06-18 03:03:02 -07:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
char *path;
|
|
|
|
int name_start;
|
|
|
|
} Scanned_Entry;
|
|
|
|
|
|
|
|
static Eina_Hash *already_scanned_path = NULL;
|
|
|
|
|
|
|
|
static void
|
|
|
|
cache_theme_change_verify(Efreet_Cache_Icon_Theme *theme)
|
|
|
|
{
|
|
|
|
Eina_Bool changed = EINA_FALSE;
|
|
|
|
Eina_List *l;
|
|
|
|
Efreet_Icon_Theme_Directory *d;
|
|
|
|
char buf[PATH_MAX], *tdir, *sep;
|
|
|
|
|
|
|
|
tdir = strdup(theme->path);
|
|
|
|
sep = strrchr(tdir, '/');
|
|
|
|
if (sep) *sep = 0;
|
|
|
|
EINA_LIST_FOREACH(theme->theme.directories, l, d)
|
|
|
|
{
|
|
|
|
snprintf(buf, sizeof(buf), "%s/%s", tdir, d->name);
|
|
|
|
if (cache_directory_modified(theme->dirs, buf))
|
|
|
|
{
|
|
|
|
changed = EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
free(tdir);
|
|
|
|
if (changed) theme->changed = changed;
|
|
|
|
}
|
|
|
|
|
2010-11-26 06:56:23 -08:00
|
|
|
static Eina_Bool
|
|
|
|
cache_scan_path_dir(Efreet_Icon_Theme *theme,
|
|
|
|
const char *path,
|
|
|
|
Efreet_Icon_Theme_Directory *dir,
|
2011-08-16 05:46:24 -07:00
|
|
|
Eina_Hash *icons)
|
2010-11-15 13:07:22 -08:00
|
|
|
{
|
|
|
|
Eina_Iterator *it;
|
|
|
|
char buf[PATH_MAX];
|
2010-11-26 06:56:23 -08:00
|
|
|
Eina_File_Direct_Info *entry;
|
efreetd - cache - add more statinfo work around 0 mtime distros
some distros 9notably in this case nixos) want to do reproducible
builds. to them this means going around setting mtime for all files to
0. this means efreetd not only thinks mtime is invalid/stupid (0 is
generally just that as midnight on jan 1 1970 is not exactly a
sensible dare for a modified timestamp of a file as no filesystem with
any sanity will have not been modified since that time), but it keeps
mtime at 0 even when things update. this totally breaks efreetd that
expects to find mtime increases over time as things change. it's
necessary because it has to perform a "are mu caches up to date" scan
of all file data it caches and it needs to know if it should rebuild
something based on this.
so this does a few things:
1. it makes mtime have to be an exact match to the cache, not cache
mtime >= file mtime. so any change forward or back is an inavlidation.
2. it now also uses ctime, mode, size, uid, gid, block count and if a
symlink, the sha1 of the symlink path in addition and any change to
these == invalid.
this adds a lot of code and changes how dirs get scanned a bit but it
means it can pick up changes on these 0 mtime distros.
interestingly the policy of mtime being 0 is to have a reprodcible fs
... but ctime still changes and is > 0, as does inode info, so it's
not actually possible to have it totally work... but they try still,
so this is a fix for that problem.
whilst i was doing thisi also noticed efreetd re-red dirs many times
due to icon theme inhritance. i also fixed that to do a LOT less
syscalls by only scanning a dir once as i was rejigging the scanning
code at the time anyway. this should optimize thr scan costs at
efreetd startup too.
@fix
@opt
2020-06-18 03:03:02 -07:00
|
|
|
Eina_List *dirs = NULL;
|
|
|
|
Eina_List *l;
|
|
|
|
char *ext;
|
|
|
|
Scanned_Entry *scentry;
|
2010-11-15 13:07:22 -08:00
|
|
|
|
|
|
|
snprintf(buf, sizeof(buf), "%s/%s", path, dir->name);
|
efreetd - cache - add more statinfo work around 0 mtime distros
some distros 9notably in this case nixos) want to do reproducible
builds. to them this means going around setting mtime for all files to
0. this means efreetd not only thinks mtime is invalid/stupid (0 is
generally just that as midnight on jan 1 1970 is not exactly a
sensible dare for a modified timestamp of a file as no filesystem with
any sanity will have not been modified since that time), but it keeps
mtime at 0 even when things update. this totally breaks efreetd that
expects to find mtime increases over time as things change. it's
necessary because it has to perform a "are mu caches up to date" scan
of all file data it caches and it needs to know if it should rebuild
something based on this.
so this does a few things:
1. it makes mtime have to be an exact match to the cache, not cache
mtime >= file mtime. so any change forward or back is an inavlidation.
2. it now also uses ctime, mode, size, uid, gid, block count and if a
symlink, the sha1 of the symlink path in addition and any change to
these == invalid.
this adds a lot of code and changes how dirs get scanned a bit but it
means it can pick up changes on these 0 mtime distros.
interestingly the policy of mtime being 0 is to have a reprodcible fs
... but ctime still changes and is > 0, as does inode info, so it's
not actually possible to have it totally work... but they try still,
so this is a fix for that problem.
whilst i was doing thisi also noticed efreetd re-red dirs many times
due to icon theme inhritance. i also fixed that to do a LOT less
syscalls by only scanning a dir once as i was rejigging the scanning
code at the time anyway. this should optimize thr scan costs at
efreetd startup too.
@fix
@opt
2020-06-18 03:03:02 -07:00
|
|
|
// we wont ever free this - no point
|
|
|
|
if (!already_scanned_path)
|
|
|
|
already_scanned_path = eina_hash_string_superfast_new(NULL);
|
|
|
|
dirs = eina_hash_find(already_scanned_path, buf);
|
|
|
|
if ((intptr_t)dirs == (intptr_t)(-1L)) return EINA_TRUE;
|
|
|
|
else if (!dirs)
|
|
|
|
{
|
|
|
|
it = eina_file_stat_ls(buf);
|
|
|
|
if (!it)
|
|
|
|
{
|
|
|
|
eina_hash_add(already_scanned_path, buf, (void *)(intptr_t)(-1L));
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EINA_ITERATOR_FOREACH(it, entry)
|
|
|
|
{
|
|
|
|
if (entry->type == EINA_FILE_DIR) continue;
|
|
|
|
ext = strrchr(entry->path + entry->name_start, '.');
|
|
|
|
if (!ext || !cache_extension_lookup(ext)) continue;
|
|
|
|
scentry = malloc(sizeof(Scanned_Entry));
|
|
|
|
if (!scentry)
|
|
|
|
{
|
|
|
|
ERR("Out of memory");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
scentry->name_start = entry->name_start;
|
|
|
|
scentry->path = strdup(entry->path);
|
|
|
|
if (!scentry->path)
|
|
|
|
{
|
|
|
|
ERR("Out of memory");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
dirs = eina_list_append(dirs, scentry);
|
|
|
|
}
|
|
|
|
eina_iterator_free(it);
|
|
|
|
if (dirs)
|
|
|
|
eina_hash_add(already_scanned_path, buf, dirs);
|
|
|
|
else
|
|
|
|
eina_hash_add(already_scanned_path, buf, (void *)(intptr_t)(-1L));
|
|
|
|
}
|
2010-11-26 06:56:23 -08:00
|
|
|
|
efreetd - cache - add more statinfo work around 0 mtime distros
some distros 9notably in this case nixos) want to do reproducible
builds. to them this means going around setting mtime for all files to
0. this means efreetd not only thinks mtime is invalid/stupid (0 is
generally just that as midnight on jan 1 1970 is not exactly a
sensible dare for a modified timestamp of a file as no filesystem with
any sanity will have not been modified since that time), but it keeps
mtime at 0 even when things update. this totally breaks efreetd that
expects to find mtime increases over time as things change. it's
necessary because it has to perform a "are mu caches up to date" scan
of all file data it caches and it needs to know if it should rebuild
something based on this.
so this does a few things:
1. it makes mtime have to be an exact match to the cache, not cache
mtime >= file mtime. so any change forward or back is an inavlidation.
2. it now also uses ctime, mode, size, uid, gid, block count and if a
symlink, the sha1 of the symlink path in addition and any change to
these == invalid.
this adds a lot of code and changes how dirs get scanned a bit but it
means it can pick up changes on these 0 mtime distros.
interestingly the policy of mtime being 0 is to have a reprodcible fs
... but ctime still changes and is > 0, as does inode info, so it's
not actually possible to have it totally work... but they try still,
so this is a fix for that problem.
whilst i was doing thisi also noticed efreetd re-red dirs many times
due to icon theme inhritance. i also fixed that to do a LOT less
syscalls by only scanning a dir once as i was rejigging the scanning
code at the time anyway. this should optimize thr scan costs at
efreetd startup too.
@fix
@opt
2020-06-18 03:03:02 -07:00
|
|
|
EINA_LIST_FOREACH(dirs, l, scentry)
|
2010-11-27 12:36:27 -08:00
|
|
|
{
|
|
|
|
Efreet_Cache_Icon *icon;
|
|
|
|
char *name;
|
2017-07-23 21:37:57 -07:00
|
|
|
const char **tmp;
|
2010-11-27 12:36:27 -08:00
|
|
|
unsigned int i;
|
|
|
|
|
efreetd - cache - add more statinfo work around 0 mtime distros
some distros 9notably in this case nixos) want to do reproducible
builds. to them this means going around setting mtime for all files to
0. this means efreetd not only thinks mtime is invalid/stupid (0 is
generally just that as midnight on jan 1 1970 is not exactly a
sensible dare for a modified timestamp of a file as no filesystem with
any sanity will have not been modified since that time), but it keeps
mtime at 0 even when things update. this totally breaks efreetd that
expects to find mtime increases over time as things change. it's
necessary because it has to perform a "are mu caches up to date" scan
of all file data it caches and it needs to know if it should rebuild
something based on this.
so this does a few things:
1. it makes mtime have to be an exact match to the cache, not cache
mtime >= file mtime. so any change forward or back is an inavlidation.
2. it now also uses ctime, mode, size, uid, gid, block count and if a
symlink, the sha1 of the symlink path in addition and any change to
these == invalid.
this adds a lot of code and changes how dirs get scanned a bit but it
means it can pick up changes on these 0 mtime distros.
interestingly the policy of mtime being 0 is to have a reprodcible fs
... but ctime still changes and is > 0, as does inode info, so it's
not actually possible to have it totally work... but they try still,
so this is a fix for that problem.
whilst i was doing thisi also noticed efreetd re-red dirs many times
due to icon theme inhritance. i also fixed that to do a LOT less
syscalls by only scanning a dir once as i was rejigging the scanning
code at the time anyway. this should optimize thr scan costs at
efreetd startup too.
@fix
@opt
2020-06-18 03:03:02 -07:00
|
|
|
ext = strrchr(scentry->path + scentry->name_start, '.');
|
2020-06-18 16:56:08 -07:00
|
|
|
if (!ext) continue;
|
2010-11-27 12:36:27 -08:00
|
|
|
/* icon with known extension */
|
efreetd - cache - add more statinfo work around 0 mtime distros
some distros 9notably in this case nixos) want to do reproducible
builds. to them this means going around setting mtime for all files to
0. this means efreetd not only thinks mtime is invalid/stupid (0 is
generally just that as midnight on jan 1 1970 is not exactly a
sensible dare for a modified timestamp of a file as no filesystem with
any sanity will have not been modified since that time), but it keeps
mtime at 0 even when things update. this totally breaks efreetd that
expects to find mtime increases over time as things change. it's
necessary because it has to perform a "are mu caches up to date" scan
of all file data it caches and it needs to know if it should rebuild
something based on this.
so this does a few things:
1. it makes mtime have to be an exact match to the cache, not cache
mtime >= file mtime. so any change forward or back is an inavlidation.
2. it now also uses ctime, mode, size, uid, gid, block count and if a
symlink, the sha1 of the symlink path in addition and any change to
these == invalid.
this adds a lot of code and changes how dirs get scanned a bit but it
means it can pick up changes on these 0 mtime distros.
interestingly the policy of mtime being 0 is to have a reprodcible fs
... but ctime still changes and is > 0, as does inode info, so it's
not actually possible to have it totally work... but they try still,
so this is a fix for that problem.
whilst i was doing thisi also noticed efreetd re-red dirs many times
due to icon theme inhritance. i also fixed that to do a LOT less
syscalls by only scanning a dir once as i was rejigging the scanning
code at the time anyway. this should optimize thr scan costs at
efreetd startup too.
@fix
@opt
2020-06-18 03:03:02 -07:00
|
|
|
name = scentry->path + scentry->name_start;
|
2010-11-27 12:36:27 -08:00
|
|
|
*ext = '\0';
|
|
|
|
|
|
|
|
icon = eina_hash_find(icons, name);
|
|
|
|
if (!icon)
|
|
|
|
{
|
|
|
|
icon = NEW(Efreet_Cache_Icon, 1);
|
|
|
|
icon->theme = eina_stringshare_add(theme->name.internal);
|
2010-11-29 05:17:33 -08:00
|
|
|
eina_array_push(strs, icon->theme);
|
2010-11-27 12:36:27 -08:00
|
|
|
eina_hash_add(icons, name, icon);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* find if we have the same icon in another type */
|
|
|
|
for (i = 0; i < icon->icons_count; ++i)
|
|
|
|
{
|
|
|
|
if ((icon->icons[i]->type == dir->type) &&
|
|
|
|
(icon->icons[i]->normal == dir->size.normal) &&
|
|
|
|
(icon->icons[i]->max == dir->size.max) &&
|
|
|
|
(icon->icons[i]->min == dir->size.min))
|
2010-11-15 13:07:22 -08:00
|
|
|
break;
|
2010-11-27 12:36:27 -08:00
|
|
|
}
|
2010-11-26 06:56:23 -08:00
|
|
|
|
2010-11-27 12:36:27 -08:00
|
|
|
*ext = '.';
|
2010-11-26 06:56:23 -08:00
|
|
|
|
2010-11-27 12:36:27 -08:00
|
|
|
if (i != icon->icons_count)
|
|
|
|
{
|
|
|
|
unsigned int j;
|
2010-11-26 06:56:23 -08:00
|
|
|
|
2010-11-27 12:36:27 -08:00
|
|
|
/* check if the path already exist */
|
|
|
|
for (j = 0; j < icon->icons[i]->paths_count; ++j)
|
efreetd - cache - add more statinfo work around 0 mtime distros
some distros 9notably in this case nixos) want to do reproducible
builds. to them this means going around setting mtime for all files to
0. this means efreetd not only thinks mtime is invalid/stupid (0 is
generally just that as midnight on jan 1 1970 is not exactly a
sensible dare for a modified timestamp of a file as no filesystem with
any sanity will have not been modified since that time), but it keeps
mtime at 0 even when things update. this totally breaks efreetd that
expects to find mtime increases over time as things change. it's
necessary because it has to perform a "are mu caches up to date" scan
of all file data it caches and it needs to know if it should rebuild
something based on this.
so this does a few things:
1. it makes mtime have to be an exact match to the cache, not cache
mtime >= file mtime. so any change forward or back is an inavlidation.
2. it now also uses ctime, mode, size, uid, gid, block count and if a
symlink, the sha1 of the symlink path in addition and any change to
these == invalid.
this adds a lot of code and changes how dirs get scanned a bit but it
means it can pick up changes on these 0 mtime distros.
interestingly the policy of mtime being 0 is to have a reprodcible fs
... but ctime still changes and is > 0, as does inode info, so it's
not actually possible to have it totally work... but they try still,
so this is a fix for that problem.
whilst i was doing thisi also noticed efreetd re-red dirs many times
due to icon theme inhritance. i also fixed that to do a LOT less
syscalls by only scanning a dir once as i was rejigging the scanning
code at the time anyway. this should optimize thr scan costs at
efreetd startup too.
@fix
@opt
2020-06-18 03:03:02 -07:00
|
|
|
if (!strcmp(icon->icons[i]->paths[j], scentry->path))
|
2011-02-01 00:27:53 -08:00
|
|
|
break;
|
2010-11-26 06:56:23 -08:00
|
|
|
|
2010-11-27 12:36:27 -08:00
|
|
|
if (j != icon->icons[i]->paths_count)
|
2011-02-01 00:27:53 -08:00
|
|
|
continue;
|
2012-10-10 13:56:29 -07:00
|
|
|
|
|
|
|
/* If we are inherited, check if we already have extension */
|
|
|
|
if (strcmp(icon->theme, theme->name.internal))
|
|
|
|
{
|
|
|
|
const char *ext2;
|
|
|
|
int has_ext = 0;
|
|
|
|
for (j = 0; j < icon->icons[i]->paths_count; ++j)
|
|
|
|
{
|
|
|
|
ext2 = strrchr(icon->icons[i]->paths[j], '.');
|
|
|
|
if (ext2)
|
|
|
|
{
|
|
|
|
ext2++;
|
|
|
|
has_ext = !strcmp((ext + 1), ext2);
|
|
|
|
if (has_ext) break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (has_ext)
|
|
|
|
continue;
|
|
|
|
}
|
2010-11-27 12:36:27 -08:00
|
|
|
}
|
|
|
|
/* no icon match so add a new one */
|
2012-10-10 13:56:29 -07:00
|
|
|
/* only allow to add new icon for main theme
|
|
|
|
* if we allow inherited theme to add new icons,
|
|
|
|
* we will get weird effects when icon scales
|
|
|
|
*/
|
|
|
|
else if (!strcmp(icon->theme, theme->name.internal))
|
2010-11-27 12:36:27 -08:00
|
|
|
{
|
2017-07-23 21:37:57 -07:00
|
|
|
Efreet_Cache_Icon_Element **tmp2;
|
|
|
|
|
|
|
|
tmp2 = realloc(icon->icons,
|
|
|
|
sizeof(Efreet_Cache_Icon_Element *) * (++icon->icons_count));
|
|
|
|
if (!tmp2)
|
|
|
|
{
|
|
|
|
ERR("Out of memory");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
icon->icons = tmp2;
|
2010-11-27 12:36:27 -08:00
|
|
|
icon->icons[i] = NEW(Efreet_Cache_Icon_Element, 1);
|
|
|
|
icon->icons[i]->type = dir->type;
|
|
|
|
icon->icons[i]->normal = dir->size.normal;
|
|
|
|
icon->icons[i]->min = dir->size.min;
|
|
|
|
icon->icons[i]->max = dir->size.max;
|
|
|
|
icon->icons[i]->paths = NULL;
|
|
|
|
icon->icons[i]->paths_count = 0;
|
|
|
|
}
|
2012-10-10 13:56:29 -07:00
|
|
|
else
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
2010-11-27 12:36:27 -08:00
|
|
|
|
|
|
|
/* and finally store the path */
|
2017-07-23 21:37:57 -07:00
|
|
|
tmp = realloc(icon->icons[i]->paths,
|
|
|
|
sizeof(char *) * (icon->icons[i]->paths_count + 1));
|
|
|
|
if (!tmp)
|
|
|
|
{
|
|
|
|
ERR("Out of memory");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
icon->icons[i]->paths = tmp;
|
efreetd - cache - add more statinfo work around 0 mtime distros
some distros 9notably in this case nixos) want to do reproducible
builds. to them this means going around setting mtime for all files to
0. this means efreetd not only thinks mtime is invalid/stupid (0 is
generally just that as midnight on jan 1 1970 is not exactly a
sensible dare for a modified timestamp of a file as no filesystem with
any sanity will have not been modified since that time), but it keeps
mtime at 0 even when things update. this totally breaks efreetd that
expects to find mtime increases over time as things change. it's
necessary because it has to perform a "are mu caches up to date" scan
of all file data it caches and it needs to know if it should rebuild
something based on this.
so this does a few things:
1. it makes mtime have to be an exact match to the cache, not cache
mtime >= file mtime. so any change forward or back is an inavlidation.
2. it now also uses ctime, mode, size, uid, gid, block count and if a
symlink, the sha1 of the symlink path in addition and any change to
these == invalid.
this adds a lot of code and changes how dirs get scanned a bit but it
means it can pick up changes on these 0 mtime distros.
interestingly the policy of mtime being 0 is to have a reprodcible fs
... but ctime still changes and is > 0, as does inode info, so it's
not actually possible to have it totally work... but they try still,
so this is a fix for that problem.
whilst i was doing thisi also noticed efreetd re-red dirs many times
due to icon theme inhritance. i also fixed that to do a LOT less
syscalls by only scanning a dir once as i was rejigging the scanning
code at the time anyway. this should optimize thr scan costs at
efreetd startup too.
@fix
@opt
2020-06-18 03:03:02 -07:00
|
|
|
icon->icons[i]->paths[icon->icons[i]->paths_count] = eina_stringshare_add(scentry->path);
|
2010-11-29 05:17:33 -08:00
|
|
|
eina_array_push(strs, icon->icons[i]->paths[icon->icons[i]->paths_count++]);
|
2010-11-27 12:36:27 -08:00
|
|
|
}
|
2011-01-31 03:43:52 -08:00
|
|
|
return EINA_TRUE;
|
2010-11-15 13:07:22 -08:00
|
|
|
}
|
|
|
|
|
2011-01-31 03:44:02 -08:00
|
|
|
static Eina_Bool
|
2011-08-16 05:46:24 -07:00
|
|
|
cache_scan_path(Efreet_Icon_Theme *theme, Eina_Hash *icons, const char *path)
|
2010-11-15 13:07:22 -08:00
|
|
|
{
|
|
|
|
Eina_List *l;
|
|
|
|
Efreet_Icon_Theme_Directory *dir;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(theme->directories, l, dir)
|
efreetd - cache - add more statinfo work around 0 mtime distros
some distros 9notably in this case nixos) want to do reproducible
builds. to them this means going around setting mtime for all files to
0. this means efreetd not only thinks mtime is invalid/stupid (0 is
generally just that as midnight on jan 1 1970 is not exactly a
sensible dare for a modified timestamp of a file as no filesystem with
any sanity will have not been modified since that time), but it keeps
mtime at 0 even when things update. this totally breaks efreetd that
expects to find mtime increases over time as things change. it's
necessary because it has to perform a "are mu caches up to date" scan
of all file data it caches and it needs to know if it should rebuild
something based on this.
so this does a few things:
1. it makes mtime have to be an exact match to the cache, not cache
mtime >= file mtime. so any change forward or back is an inavlidation.
2. it now also uses ctime, mode, size, uid, gid, block count and if a
symlink, the sha1 of the symlink path in addition and any change to
these == invalid.
this adds a lot of code and changes how dirs get scanned a bit but it
means it can pick up changes on these 0 mtime distros.
interestingly the policy of mtime being 0 is to have a reprodcible fs
... but ctime still changes and is > 0, as does inode info, so it's
not actually possible to have it totally work... but they try still,
so this is a fix for that problem.
whilst i was doing thisi also noticed efreetd re-red dirs many times
due to icon theme inhritance. i also fixed that to do a LOT less
syscalls by only scanning a dir once as i was rejigging the scanning
code at the time anyway. this should optimize thr scan costs at
efreetd startup too.
@fix
@opt
2020-06-18 03:03:02 -07:00
|
|
|
{
|
2011-08-16 05:46:24 -07:00
|
|
|
if (!cache_scan_path_dir(theme, path, dir, icons)) return EINA_FALSE;
|
efreetd - cache - add more statinfo work around 0 mtime distros
some distros 9notably in this case nixos) want to do reproducible
builds. to them this means going around setting mtime for all files to
0. this means efreetd not only thinks mtime is invalid/stupid (0 is
generally just that as midnight on jan 1 1970 is not exactly a
sensible dare for a modified timestamp of a file as no filesystem with
any sanity will have not been modified since that time), but it keeps
mtime at 0 even when things update. this totally breaks efreetd that
expects to find mtime increases over time as things change. it's
necessary because it has to perform a "are mu caches up to date" scan
of all file data it caches and it needs to know if it should rebuild
something based on this.
so this does a few things:
1. it makes mtime have to be an exact match to the cache, not cache
mtime >= file mtime. so any change forward or back is an inavlidation.
2. it now also uses ctime, mode, size, uid, gid, block count and if a
symlink, the sha1 of the symlink path in addition and any change to
these == invalid.
this adds a lot of code and changes how dirs get scanned a bit but it
means it can pick up changes on these 0 mtime distros.
interestingly the policy of mtime being 0 is to have a reprodcible fs
... but ctime still changes and is > 0, as does inode info, so it's
not actually possible to have it totally work... but they try still,
so this is a fix for that problem.
whilst i was doing thisi also noticed efreetd re-red dirs many times
due to icon theme inhritance. i also fixed that to do a LOT less
syscalls by only scanning a dir once as i was rejigging the scanning
code at the time anyway. this should optimize thr scan costs at
efreetd startup too.
@fix
@opt
2020-06-18 03:03:02 -07:00
|
|
|
}
|
2010-11-26 06:56:23 -08:00
|
|
|
|
2011-01-31 03:44:02 -08:00
|
|
|
return EINA_TRUE;
|
2010-11-15 13:07:22 -08:00
|
|
|
}
|
|
|
|
|
2010-11-26 06:56:23 -08:00
|
|
|
static Eina_Bool
|
2011-08-16 05:46:24 -07:00
|
|
|
cache_scan(Efreet_Icon_Theme *theme, Eina_Hash *themes, Eina_Hash *icons)
|
2010-11-15 13:07:22 -08:00
|
|
|
{
|
|
|
|
Eina_List *l;
|
|
|
|
const char *path;
|
|
|
|
const char *name;
|
|
|
|
|
2011-01-31 03:43:52 -08:00
|
|
|
if (!theme) return EINA_TRUE;
|
|
|
|
if (eina_hash_find(themes, theme->name.internal)) return EINA_TRUE;
|
2010-11-15 13:07:22 -08:00
|
|
|
eina_hash_direct_add(themes, theme->name.internal, theme);
|
|
|
|
|
|
|
|
/* scan theme */
|
|
|
|
EINA_LIST_FOREACH(theme->paths, l, path)
|
2011-08-16 05:46:24 -07:00
|
|
|
if (!cache_scan_path(theme, icons, path)) return EINA_FALSE;
|
2010-11-15 13:07:22 -08:00
|
|
|
|
|
|
|
/* scan inherits */
|
|
|
|
if (theme->inherits)
|
2010-11-27 12:36:27 -08:00
|
|
|
{
|
|
|
|
EINA_LIST_FOREACH(theme->inherits, l, name)
|
|
|
|
{
|
|
|
|
Efreet_Icon_Theme *inherit;
|
|
|
|
|
2010-12-08 13:39:43 -08:00
|
|
|
inherit = eina_hash_find(icon_themes, name);
|
2011-03-18 12:47:57 -07:00
|
|
|
if (!inherit)
|
|
|
|
INF("Theme `%s` not found for `%s`.",
|
2011-03-18 13:00:22 -07:00
|
|
|
name, theme->name.internal);
|
2011-08-16 05:46:24 -07:00
|
|
|
if (!cache_scan(inherit, themes, icons)) return EINA_FALSE;
|
2010-11-27 12:36:27 -08:00
|
|
|
}
|
|
|
|
}
|
2010-11-16 02:32:21 -08:00
|
|
|
else if (strcmp(theme->name.internal, "hicolor"))
|
2010-11-27 12:36:27 -08:00
|
|
|
{
|
2010-12-08 13:39:43 -08:00
|
|
|
theme = eina_hash_find(icon_themes, "hicolor");
|
2011-08-16 05:46:24 -07:00
|
|
|
if (!cache_scan(theme, themes, icons)) return EINA_FALSE;
|
2010-11-27 12:36:27 -08:00
|
|
|
}
|
2010-11-26 06:56:23 -08:00
|
|
|
|
2011-01-31 03:43:52 -08:00
|
|
|
return EINA_TRUE;
|
2010-11-15 13:07:22 -08:00
|
|
|
}
|
|
|
|
|
2011-01-31 03:44:35 -08:00
|
|
|
static Eina_Bool
|
|
|
|
check_changed(Efreet_Cache_Icon_Theme *theme)
|
|
|
|
{
|
|
|
|
Eina_List *l;
|
|
|
|
const char *name;
|
|
|
|
|
|
|
|
if (!theme) return EINA_FALSE;
|
|
|
|
|
|
|
|
if (theme->changed) return EINA_TRUE;
|
|
|
|
if (theme->theme.inherits)
|
|
|
|
{
|
|
|
|
EINA_LIST_FOREACH(theme->theme.inherits, l, name)
|
|
|
|
{
|
|
|
|
Efreet_Cache_Icon_Theme *inherit;
|
|
|
|
|
|
|
|
inherit = eina_hash_find(icon_themes, name);
|
2011-03-18 12:47:57 -07:00
|
|
|
if (!inherit)
|
|
|
|
INF("Theme `%s` not found for `%s`.",
|
2011-02-19 12:54:03 -08:00
|
|
|
name, theme->theme.name.internal);
|
2011-01-31 03:44:35 -08:00
|
|
|
if (check_changed(inherit)) return EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (strcmp(theme->theme.name.internal, "hicolor"))
|
|
|
|
{
|
|
|
|
theme = eina_hash_find(icon_themes, "hicolor");
|
|
|
|
if (check_changed(theme)) return EINA_TRUE;
|
|
|
|
}
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2010-12-09 00:56:56 -08:00
|
|
|
static Efreet_Icon_Theme_Directory *
|
|
|
|
icon_theme_directory_new(Efreet_Ini *ini, const char *name)
|
|
|
|
{
|
|
|
|
Efreet_Icon_Theme_Directory *dir;
|
|
|
|
int val;
|
|
|
|
const char *tmp;
|
|
|
|
|
|
|
|
if (!ini) return NULL;
|
|
|
|
|
|
|
|
dir = NEW(Efreet_Icon_Theme_Directory, 1);
|
|
|
|
if (!dir) return NULL;
|
|
|
|
dir->name = eina_stringshare_add(name);
|
2011-01-31 03:44:35 -08:00
|
|
|
eina_array_push(strs, dir->name);
|
2010-12-09 00:56:56 -08:00
|
|
|
|
|
|
|
efreet_ini_section_set(ini, name);
|
|
|
|
|
|
|
|
tmp = efreet_ini_string_get(ini, "Context");
|
|
|
|
if (tmp)
|
|
|
|
{
|
|
|
|
if (!strcasecmp(tmp, "Actions"))
|
|
|
|
dir->context = EFREET_ICON_THEME_CONTEXT_ACTIONS;
|
|
|
|
|
|
|
|
else if (!strcasecmp(tmp, "Devices"))
|
|
|
|
dir->context = EFREET_ICON_THEME_CONTEXT_DEVICES;
|
|
|
|
|
|
|
|
else if (!strcasecmp(tmp, "FileSystems"))
|
|
|
|
dir->context = EFREET_ICON_THEME_CONTEXT_FILESYSTEMS;
|
|
|
|
|
|
|
|
else if (!strcasecmp(tmp, "MimeTypes"))
|
|
|
|
dir->context = EFREET_ICON_THEME_CONTEXT_MIMETYPES;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Threshold is fallback */
|
|
|
|
dir->type = EFREET_ICON_SIZE_TYPE_THRESHOLD;
|
|
|
|
|
|
|
|
tmp = efreet_ini_string_get(ini, "Type");
|
|
|
|
if (tmp)
|
|
|
|
{
|
|
|
|
if (!strcasecmp(tmp, "Fixed"))
|
|
|
|
dir->type = EFREET_ICON_SIZE_TYPE_FIXED;
|
|
|
|
|
|
|
|
else if (!strcasecmp(tmp, "Scalable"))
|
|
|
|
dir->type = EFREET_ICON_SIZE_TYPE_SCALABLE;
|
|
|
|
}
|
|
|
|
|
|
|
|
dir->size.normal = efreet_ini_int_get(ini, "Size");
|
|
|
|
|
|
|
|
if (dir->type == EFREET_ICON_SIZE_TYPE_THRESHOLD)
|
|
|
|
{
|
|
|
|
val = efreet_ini_int_get(ini, "Threshold");
|
|
|
|
if (val < 0) val = 2;
|
|
|
|
dir->size.max = dir->size.normal + val;
|
|
|
|
dir->size.min = dir->size.normal - val;
|
|
|
|
}
|
|
|
|
else if (dir->type == EFREET_ICON_SIZE_TYPE_SCALABLE)
|
|
|
|
{
|
|
|
|
val = efreet_ini_int_get(ini, "MinSize");
|
|
|
|
if (val < 0) dir->size.min = dir->size.normal;
|
|
|
|
else dir->size.min = val;
|
|
|
|
|
|
|
|
val = efreet_ini_int_get(ini, "MaxSize");
|
|
|
|
if (val < 0) dir->size.max = dir->size.normal;
|
|
|
|
else dir->size.max = val;
|
|
|
|
}
|
|
|
|
|
|
|
|
return dir;
|
|
|
|
}
|
|
|
|
|
2011-01-31 03:44:35 -08:00
|
|
|
static Eina_Bool
|
2011-01-31 03:44:24 -08:00
|
|
|
icon_theme_index_read(Efreet_Cache_Icon_Theme *theme, const char *path)
|
2010-12-08 13:39:43 -08:00
|
|
|
{
|
|
|
|
Efreet_Ini *ini;
|
|
|
|
Efreet_Icon_Theme_Directory *dir;
|
|
|
|
const char *tmp;
|
efreetd - cache - add more statinfo work around 0 mtime distros
some distros 9notably in this case nixos) want to do reproducible
builds. to them this means going around setting mtime for all files to
0. this means efreetd not only thinks mtime is invalid/stupid (0 is
generally just that as midnight on jan 1 1970 is not exactly a
sensible dare for a modified timestamp of a file as no filesystem with
any sanity will have not been modified since that time), but it keeps
mtime at 0 even when things update. this totally breaks efreetd that
expects to find mtime increases over time as things change. it's
necessary because it has to perform a "are mu caches up to date" scan
of all file data it caches and it needs to know if it should rebuild
something based on this.
so this does a few things:
1. it makes mtime have to be an exact match to the cache, not cache
mtime >= file mtime. so any change forward or back is an inavlidation.
2. it now also uses ctime, mode, size, uid, gid, block count and if a
symlink, the sha1 of the symlink path in addition and any change to
these == invalid.
this adds a lot of code and changes how dirs get scanned a bit but it
means it can pick up changes on these 0 mtime distros.
interestingly the policy of mtime being 0 is to have a reprodcible fs
... but ctime still changes and is > 0, as does inode info, so it's
not actually possible to have it totally work... but they try still,
so this is a fix for that problem.
whilst i was doing thisi also noticed efreetd re-red dirs many times
due to icon theme inhritance. i also fixed that to do a LOT less
syscalls by only scanning a dir once as i was rejigging the scanning
code at the time anyway. this should optimize thr scan costs at
efreetd startup too.
@fix
@opt
2020-06-18 03:03:02 -07:00
|
|
|
Efreet_Cache_Check check;
|
2010-12-08 13:39:43 -08:00
|
|
|
|
2011-01-31 03:44:35 -08:00
|
|
|
if (!theme || !path) return EINA_FALSE;
|
|
|
|
|
efreetd - cache - add more statinfo work around 0 mtime distros
some distros 9notably in this case nixos) want to do reproducible
builds. to them this means going around setting mtime for all files to
0. this means efreetd not only thinks mtime is invalid/stupid (0 is
generally just that as midnight on jan 1 1970 is not exactly a
sensible dare for a modified timestamp of a file as no filesystem with
any sanity will have not been modified since that time), but it keeps
mtime at 0 even when things update. this totally breaks efreetd that
expects to find mtime increases over time as things change. it's
necessary because it has to perform a "are mu caches up to date" scan
of all file data it caches and it needs to know if it should rebuild
something based on this.
so this does a few things:
1. it makes mtime have to be an exact match to the cache, not cache
mtime >= file mtime. so any change forward or back is an inavlidation.
2. it now also uses ctime, mode, size, uid, gid, block count and if a
symlink, the sha1 of the symlink path in addition and any change to
these == invalid.
this adds a lot of code and changes how dirs get scanned a bit but it
means it can pick up changes on these 0 mtime distros.
interestingly the policy of mtime being 0 is to have a reprodcible fs
... but ctime still changes and is > 0, as does inode info, so it's
not actually possible to have it totally work... but they try still,
so this is a fix for that problem.
whilst i was doing thisi also noticed efreetd re-red dirs many times
due to icon theme inhritance. i also fixed that to do a LOT less
syscalls by only scanning a dir once as i was rejigging the scanning
code at the time anyway. this should optimize thr scan costs at
efreetd startup too.
@fix
@opt
2020-06-18 03:03:02 -07:00
|
|
|
if (!efreet_file_cache_fill(path, &check)) return EINA_FALSE;
|
|
|
|
if (theme->path && !strcmp(theme->path, path) &&
|
|
|
|
efreet_file_cache_check(&check, &(theme->check)))
|
2011-01-31 03:44:35 -08:00
|
|
|
{
|
|
|
|
/* no change */
|
|
|
|
theme->valid = 1;
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
2012-10-18 01:10:23 -07:00
|
|
|
if (!theme->path || strcmp(theme->path, path))
|
2011-01-31 03:44:35 -08:00
|
|
|
{
|
2012-10-18 01:10:23 -07:00
|
|
|
theme->path = eina_stringshare_add(path);
|
2011-01-31 03:44:35 -08:00
|
|
|
eina_array_push(strs, theme->path);
|
|
|
|
}
|
efreetd - cache - add more statinfo work around 0 mtime distros
some distros 9notably in this case nixos) want to do reproducible
builds. to them this means going around setting mtime for all files to
0. this means efreetd not only thinks mtime is invalid/stupid (0 is
generally just that as midnight on jan 1 1970 is not exactly a
sensible dare for a modified timestamp of a file as no filesystem with
any sanity will have not been modified since that time), but it keeps
mtime at 0 even when things update. this totally breaks efreetd that
expects to find mtime increases over time as things change. it's
necessary because it has to perform a "are mu caches up to date" scan
of all file data it caches and it needs to know if it should rebuild
something based on this.
so this does a few things:
1. it makes mtime have to be an exact match to the cache, not cache
mtime >= file mtime. so any change forward or back is an inavlidation.
2. it now also uses ctime, mode, size, uid, gid, block count and if a
symlink, the sha1 of the symlink path in addition and any change to
these == invalid.
this adds a lot of code and changes how dirs get scanned a bit but it
means it can pick up changes on these 0 mtime distros.
interestingly the policy of mtime being 0 is to have a reprodcible fs
... but ctime still changes and is > 0, as does inode info, so it's
not actually possible to have it totally work... but they try still,
so this is a fix for that problem.
whilst i was doing thisi also noticed efreetd re-red dirs many times
due to icon theme inhritance. i also fixed that to do a LOT less
syscalls by only scanning a dir once as i was rejigging the scanning
code at the time anyway. this should optimize thr scan costs at
efreetd startup too.
@fix
@opt
2020-06-18 03:03:02 -07:00
|
|
|
theme->check = check;
|
2011-01-31 03:44:35 -08:00
|
|
|
theme->changed = 1;
|
2010-12-08 13:39:43 -08:00
|
|
|
|
|
|
|
ini = efreet_ini_new(path);
|
2011-01-31 03:44:35 -08:00
|
|
|
if (!ini) return EINA_FALSE;
|
2010-12-08 13:39:43 -08:00
|
|
|
if (!ini->data)
|
|
|
|
{
|
|
|
|
efreet_ini_free(ini);
|
2011-01-31 03:44:35 -08:00
|
|
|
return EINA_FALSE;
|
2010-12-08 13:39:43 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
efreet_ini_section_set(ini, "Icon Theme");
|
|
|
|
tmp = efreet_ini_localestring_get(ini, "Name");
|
2011-01-31 03:44:35 -08:00
|
|
|
if (tmp)
|
|
|
|
{
|
|
|
|
theme->theme.name.name = eina_stringshare_add(tmp);
|
|
|
|
eina_array_push(strs, theme->theme.name.name);
|
|
|
|
}
|
2010-12-08 13:39:43 -08:00
|
|
|
|
|
|
|
tmp = efreet_ini_localestring_get(ini, "Comment");
|
2011-01-31 03:44:35 -08:00
|
|
|
if (tmp)
|
|
|
|
{
|
|
|
|
theme->theme.comment = eina_stringshare_add(tmp);
|
|
|
|
eina_array_push(strs, theme->theme.comment);
|
|
|
|
}
|
2010-12-08 13:39:43 -08:00
|
|
|
|
|
|
|
tmp = efreet_ini_string_get(ini, "Example");
|
2011-01-31 03:44:35 -08:00
|
|
|
if (tmp)
|
|
|
|
{
|
|
|
|
theme->theme.example_icon = eina_stringshare_add(tmp);
|
|
|
|
eina_array_push(strs, theme->theme.example_icon);
|
|
|
|
}
|
2010-12-08 13:39:43 -08:00
|
|
|
|
|
|
|
theme->hidden = efreet_ini_boolean_get(ini, "Hidden");
|
|
|
|
|
|
|
|
theme->valid = 1;
|
|
|
|
|
|
|
|
/* Check the inheritance. If there is none we inherit from the hicolor theme */
|
|
|
|
tmp = efreet_ini_string_get(ini, "Inherits");
|
|
|
|
if (tmp)
|
|
|
|
{
|
|
|
|
char *t, *s, *p;
|
2011-01-31 03:44:35 -08:00
|
|
|
const char *i;
|
2010-12-08 13:39:43 -08:00
|
|
|
size_t len;
|
|
|
|
|
|
|
|
len = strlen(tmp) + 1;
|
|
|
|
t = alloca(len);
|
|
|
|
memcpy(t, tmp, len);
|
|
|
|
s = t;
|
|
|
|
p = strchr(s, ',');
|
|
|
|
|
|
|
|
while (p)
|
|
|
|
{
|
|
|
|
*p = '\0';
|
|
|
|
|
2011-01-31 03:44:35 -08:00
|
|
|
i = eina_stringshare_add(s);
|
|
|
|
theme->theme.inherits = eina_list_append(theme->theme.inherits, i);
|
|
|
|
eina_array_push(strs, i);
|
2010-12-08 13:39:43 -08:00
|
|
|
s = ++p;
|
|
|
|
p = strchr(s, ',');
|
|
|
|
}
|
2011-01-31 03:44:35 -08:00
|
|
|
i = eina_stringshare_add(s);
|
|
|
|
theme->theme.inherits = eina_list_append(theme->theme.inherits, i);
|
|
|
|
eina_array_push(strs, i);
|
2010-12-08 13:39:43 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* make sure this one is done last as setting the directory will change
|
|
|
|
* the ini section ... */
|
|
|
|
tmp = efreet_ini_string_get(ini, "Directories");
|
|
|
|
if (tmp)
|
|
|
|
{
|
|
|
|
char *t, *s, *p;
|
|
|
|
size_t len;
|
|
|
|
|
|
|
|
len = strlen(tmp) + 1;
|
|
|
|
t = alloca(len);
|
|
|
|
memcpy(t, tmp, len);
|
|
|
|
s = t;
|
|
|
|
p = s;
|
|
|
|
|
2012-10-10 13:28:51 -07:00
|
|
|
while ((p) && (*s))
|
2010-12-08 13:39:43 -08:00
|
|
|
{
|
|
|
|
p = strchr(s, ',');
|
|
|
|
|
|
|
|
if (p) *p = '\0';
|
|
|
|
|
2010-12-09 00:56:56 -08:00
|
|
|
dir = icon_theme_directory_new(ini, s);
|
2010-12-08 13:39:43 -08:00
|
|
|
if (!dir) goto error;
|
2011-01-31 03:44:24 -08:00
|
|
|
theme->theme.directories = eina_list_append(theme->theme.directories, dir);
|
2010-12-08 13:39:43 -08:00
|
|
|
|
|
|
|
if (p) s = ++p;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
error:
|
|
|
|
efreet_ini_free(ini);
|
2011-01-31 03:44:35 -08:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
2010-12-08 13:39:43 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
cache_theme_scan(const char *dir)
|
|
|
|
{
|
|
|
|
Eina_Iterator *it;
|
|
|
|
Eina_File_Direct_Info *entry;
|
|
|
|
|
|
|
|
it = eina_file_stat_ls(dir);
|
2011-01-31 03:43:52 -08:00
|
|
|
if (!it) return EINA_TRUE;
|
2010-12-08 13:39:43 -08:00
|
|
|
|
|
|
|
EINA_ITERATOR_FOREACH(it, entry)
|
|
|
|
{
|
2015-09-30 23:45:51 -07:00
|
|
|
char buf[PATH_MAX];
|
2011-01-31 03:44:24 -08:00
|
|
|
Efreet_Cache_Icon_Theme *theme;
|
2010-12-08 13:39:43 -08:00
|
|
|
const char *name;
|
|
|
|
const char *path;
|
efreetd - cache - add more statinfo work around 0 mtime distros
some distros 9notably in this case nixos) want to do reproducible
builds. to them this means going around setting mtime for all files to
0. this means efreetd not only thinks mtime is invalid/stupid (0 is
generally just that as midnight on jan 1 1970 is not exactly a
sensible dare for a modified timestamp of a file as no filesystem with
any sanity will have not been modified since that time), but it keeps
mtime at 0 even when things update. this totally breaks efreetd that
expects to find mtime increases over time as things change. it's
necessary because it has to perform a "are mu caches up to date" scan
of all file data it caches and it needs to know if it should rebuild
something based on this.
so this does a few things:
1. it makes mtime have to be an exact match to the cache, not cache
mtime >= file mtime. so any change forward or back is an inavlidation.
2. it now also uses ctime, mode, size, uid, gid, block count and if a
symlink, the sha1 of the symlink path in addition and any change to
these == invalid.
this adds a lot of code and changes how dirs get scanned a bit but it
means it can pick up changes on these 0 mtime distros.
interestingly the policy of mtime being 0 is to have a reprodcible fs
... but ctime still changes and is > 0, as does inode info, so it's
not actually possible to have it totally work... but they try still,
so this is a fix for that problem.
whilst i was doing thisi also noticed efreetd re-red dirs many times
due to icon theme inhritance. i also fixed that to do a LOT less
syscalls by only scanning a dir once as i was rejigging the scanning
code at the time anyway. this should optimize thr scan costs at
efreetd startup too.
@fix
@opt
2020-06-18 03:03:02 -07:00
|
|
|
Efreet_Cache_Check check;
|
|
|
|
Efreet_Cache_Directory *d;
|
2011-01-31 03:44:35 -08:00
|
|
|
|
efreetd - cache - add more statinfo work around 0 mtime distros
some distros 9notably in this case nixos) want to do reproducible
builds. to them this means going around setting mtime for all files to
0. this means efreetd not only thinks mtime is invalid/stupid (0 is
generally just that as midnight on jan 1 1970 is not exactly a
sensible dare for a modified timestamp of a file as no filesystem with
any sanity will have not been modified since that time), but it keeps
mtime at 0 even when things update. this totally breaks efreetd that
expects to find mtime increases over time as things change. it's
necessary because it has to perform a "are mu caches up to date" scan
of all file data it caches and it needs to know if it should rebuild
something based on this.
so this does a few things:
1. it makes mtime have to be an exact match to the cache, not cache
mtime >= file mtime. so any change forward or back is an inavlidation.
2. it now also uses ctime, mode, size, uid, gid, block count and if a
symlink, the sha1 of the symlink path in addition and any change to
these == invalid.
this adds a lot of code and changes how dirs get scanned a bit but it
means it can pick up changes on these 0 mtime distros.
interestingly the policy of mtime being 0 is to have a reprodcible fs
... but ctime still changes and is > 0, as does inode info, so it's
not actually possible to have it totally work... but they try still,
so this is a fix for that problem.
whilst i was doing thisi also noticed efreetd re-red dirs many times
due to icon theme inhritance. i also fixed that to do a LOT less
syscalls by only scanning a dir once as i was rejigging the scanning
code at the time anyway. this should optimize thr scan costs at
efreetd startup too.
@fix
@opt
2020-06-18 03:03:02 -07:00
|
|
|
if (!efreet_file_cache_fill(entry->path, &check)) continue;
|
2010-12-08 13:39:43 -08:00
|
|
|
|
|
|
|
if ((entry->type != EINA_FILE_DIR) &&
|
|
|
|
(entry->type != EINA_FILE_LNK))
|
|
|
|
continue;
|
|
|
|
|
2013-11-27 02:45:29 -08:00
|
|
|
if ((entry->type == EINA_FILE_LNK) &&
|
|
|
|
(!ecore_file_is_dir(entry->path)))
|
|
|
|
continue;
|
|
|
|
|
2010-12-08 13:39:43 -08:00
|
|
|
name = entry->path + entry->name_start;
|
|
|
|
theme = eina_hash_find(icon_themes, name);
|
|
|
|
|
|
|
|
if (!theme)
|
|
|
|
{
|
2011-01-31 03:44:24 -08:00
|
|
|
theme = NEW(Efreet_Cache_Icon_Theme, 1);
|
|
|
|
theme->theme.name.internal = eina_stringshare_add(name);
|
2011-01-31 03:44:35 -08:00
|
|
|
eina_array_push(strs, theme->theme.name.internal);
|
2010-12-08 13:39:43 -08:00
|
|
|
eina_hash_direct_add(icon_themes,
|
2011-01-31 03:44:24 -08:00
|
|
|
(void *)theme->theme.name.internal, theme);
|
2011-01-31 03:44:35 -08:00
|
|
|
theme->changed = 1;
|
|
|
|
}
|
efreetd - cache - add more statinfo work around 0 mtime distros
some distros 9notably in this case nixos) want to do reproducible
builds. to them this means going around setting mtime for all files to
0. this means efreetd not only thinks mtime is invalid/stupid (0 is
generally just that as midnight on jan 1 1970 is not exactly a
sensible dare for a modified timestamp of a file as no filesystem with
any sanity will have not been modified since that time), but it keeps
mtime at 0 even when things update. this totally breaks efreetd that
expects to find mtime increases over time as things change. it's
necessary because it has to perform a "are mu caches up to date" scan
of all file data it caches and it needs to know if it should rebuild
something based on this.
so this does a few things:
1. it makes mtime have to be an exact match to the cache, not cache
mtime >= file mtime. so any change forward or back is an inavlidation.
2. it now also uses ctime, mode, size, uid, gid, block count and if a
symlink, the sha1 of the symlink path in addition and any change to
these == invalid.
this adds a lot of code and changes how dirs get scanned a bit but it
means it can pick up changes on these 0 mtime distros.
interestingly the policy of mtime being 0 is to have a reprodcible fs
... but ctime still changes and is > 0, as does inode info, so it's
not actually possible to have it totally work... but they try still,
so this is a fix for that problem.
whilst i was doing thisi also noticed efreetd re-red dirs many times
due to icon theme inhritance. i also fixed that to do a LOT less
syscalls by only scanning a dir once as i was rejigging the scanning
code at the time anyway. this should optimize thr scan costs at
efreetd startup too.
@fix
@opt
2020-06-18 03:03:02 -07:00
|
|
|
|
|
|
|
d = NULL;
|
|
|
|
if (theme->dirs)
|
|
|
|
d = eina_hash_find(theme->dirs, entry->path);
|
|
|
|
if (!d)
|
|
|
|
{
|
|
|
|
if (!theme->dirs)
|
|
|
|
theme->dirs = eina_hash_string_superfast_new(NULL);
|
2011-01-31 03:44:35 -08:00
|
|
|
theme->changed = 1;
|
efreetd - cache - add more statinfo work around 0 mtime distros
some distros 9notably in this case nixos) want to do reproducible
builds. to them this means going around setting mtime for all files to
0. this means efreetd not only thinks mtime is invalid/stupid (0 is
generally just that as midnight on jan 1 1970 is not exactly a
sensible dare for a modified timestamp of a file as no filesystem with
any sanity will have not been modified since that time), but it keeps
mtime at 0 even when things update. this totally breaks efreetd that
expects to find mtime increases over time as things change. it's
necessary because it has to perform a "are mu caches up to date" scan
of all file data it caches and it needs to know if it should rebuild
something based on this.
so this does a few things:
1. it makes mtime have to be an exact match to the cache, not cache
mtime >= file mtime. so any change forward or back is an inavlidation.
2. it now also uses ctime, mode, size, uid, gid, block count and if a
symlink, the sha1 of the symlink path in addition and any change to
these == invalid.
this adds a lot of code and changes how dirs get scanned a bit but it
means it can pick up changes on these 0 mtime distros.
interestingly the policy of mtime being 0 is to have a reprodcible fs
... but ctime still changes and is > 0, as does inode info, so it's
not actually possible to have it totally work... but they try still,
so this is a fix for that problem.
whilst i was doing thisi also noticed efreetd re-red dirs many times
due to icon theme inhritance. i also fixed that to do a LOT less
syscalls by only scanning a dir once as i was rejigging the scanning
code at the time anyway. this should optimize thr scan costs at
efreetd startup too.
@fix
@opt
2020-06-18 03:03:02 -07:00
|
|
|
d = NEW(Efreet_Cache_Directory, 1);
|
|
|
|
d->check = check;
|
|
|
|
eina_hash_add(theme->dirs, entry->path, d);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!efreet_file_cache_check(&check, &(d->check)))
|
|
|
|
{
|
|
|
|
d->check = check;
|
|
|
|
theme->changed = 1;
|
|
|
|
}
|
2010-12-08 13:39:43 -08:00
|
|
|
}
|
|
|
|
|
2011-01-31 03:44:35 -08:00
|
|
|
/* TODO: We need to handle change in order of included paths */
|
|
|
|
if (!eina_list_search_unsorted(theme->theme.paths, EINA_COMPARE_CB(strcmp), entry->path))
|
|
|
|
{
|
|
|
|
path = eina_stringshare_add(entry->path);
|
2011-01-31 03:44:24 -08:00
|
|
|
theme->theme.paths = eina_list_append(theme->theme.paths, path);
|
2011-01-31 03:44:35 -08:00
|
|
|
eina_array_push(strs, path);
|
|
|
|
theme->changed = 1;
|
|
|
|
}
|
2010-12-08 13:39:43 -08:00
|
|
|
|
|
|
|
/* we're already valid so no reason to check for an index.theme file */
|
|
|
|
if (theme->valid) continue;
|
|
|
|
|
|
|
|
/* if the index.theme file exists we parse it into the theme */
|
|
|
|
memcpy(buf, entry->path, entry->path_length);
|
|
|
|
memcpy(buf + entry->path_length, "/index.theme", sizeof("/index.theme"));
|
|
|
|
if (ecore_file_exists(buf))
|
2011-01-31 03:44:35 -08:00
|
|
|
{
|
|
|
|
if (!icon_theme_index_read(theme, buf))
|
|
|
|
theme->valid = 0;
|
|
|
|
}
|
2010-12-08 13:39:43 -08:00
|
|
|
}
|
|
|
|
eina_iterator_free(it);
|
2011-01-31 03:43:52 -08:00
|
|
|
return EINA_TRUE;
|
2010-12-08 13:39:43 -08:00
|
|
|
}
|
|
|
|
|
2010-11-26 06:56:23 -08:00
|
|
|
static int
|
|
|
|
cache_lock_file(void)
|
|
|
|
{
|
2010-11-27 12:36:27 -08:00
|
|
|
char file[PATH_MAX];
|
|
|
|
struct flock fl;
|
|
|
|
int lockfd;
|
|
|
|
|
2010-12-04 08:02:20 -08:00
|
|
|
snprintf(file, sizeof(file), "%s/efreet/icon_data.lock", efreet_cache_home_get());
|
2015-12-03 02:42:08 -08:00
|
|
|
lockfd = open(file, O_CREAT | O_BINARY | O_RDWR, S_IRUSR | S_IWUSR);
|
2010-11-27 12:36:27 -08:00
|
|
|
if (lockfd < 0) return -1;
|
2011-02-07 13:33:33 -08:00
|
|
|
efreet_fsetowner(lockfd);
|
2010-11-27 12:36:27 -08:00
|
|
|
|
|
|
|
memset(&fl, 0, sizeof(struct flock));
|
|
|
|
fl.l_type = F_WRLCK;
|
|
|
|
fl.l_whence = SEEK_SET;
|
|
|
|
if (fcntl(lockfd, F_SETLK, &fl) < 0)
|
|
|
|
{
|
2011-03-18 12:47:57 -07:00
|
|
|
WRN("LOCKED! You may want to delete %s if this persists", file);
|
2010-11-26 06:56:23 -08:00
|
|
|
close(lockfd);
|
|
|
|
return -1;
|
2010-11-27 12:36:27 -08:00
|
|
|
}
|
2010-11-26 06:56:23 -08:00
|
|
|
|
2010-11-27 12:36:27 -08:00
|
|
|
return lockfd;
|
2010-11-26 06:56:23 -08:00
|
|
|
}
|
|
|
|
|
2010-12-08 13:39:43 -08:00
|
|
|
static void
|
2011-01-31 03:44:24 -08:00
|
|
|
icon_theme_free(Efreet_Cache_Icon_Theme *theme)
|
2010-12-08 13:39:43 -08:00
|
|
|
{
|
|
|
|
void *data;
|
|
|
|
|
2011-01-31 03:44:35 -08:00
|
|
|
eina_list_free(theme->theme.paths);
|
|
|
|
eina_list_free(theme->theme.inherits);
|
efreetd - cache - add more statinfo work around 0 mtime distros
some distros 9notably in this case nixos) want to do reproducible
builds. to them this means going around setting mtime for all files to
0. this means efreetd not only thinks mtime is invalid/stupid (0 is
generally just that as midnight on jan 1 1970 is not exactly a
sensible dare for a modified timestamp of a file as no filesystem with
any sanity will have not been modified since that time), but it keeps
mtime at 0 even when things update. this totally breaks efreetd that
expects to find mtime increases over time as things change. it's
necessary because it has to perform a "are mu caches up to date" scan
of all file data it caches and it needs to know if it should rebuild
something based on this.
so this does a few things:
1. it makes mtime have to be an exact match to the cache, not cache
mtime >= file mtime. so any change forward or back is an inavlidation.
2. it now also uses ctime, mode, size, uid, gid, block count and if a
symlink, the sha1 of the symlink path in addition and any change to
these == invalid.
this adds a lot of code and changes how dirs get scanned a bit but it
means it can pick up changes on these 0 mtime distros.
interestingly the policy of mtime being 0 is to have a reprodcible fs
... but ctime still changes and is > 0, as does inode info, so it's
not actually possible to have it totally work... but they try still,
so this is a fix for that problem.
whilst i was doing thisi also noticed efreetd re-red dirs many times
due to icon theme inhritance. i also fixed that to do a LOT less
syscalls by only scanning a dir once as i was rejigging the scanning
code at the time anyway. this should optimize thr scan costs at
efreetd startup too.
@fix
@opt
2020-06-18 03:03:02 -07:00
|
|
|
EINA_LIST_FREE(theme->theme.directories, data) free(data);
|
2011-01-31 03:44:35 -08:00
|
|
|
if (theme->dirs) efreet_hash_free(theme->dirs, free);
|
2010-12-08 13:39:43 -08:00
|
|
|
free(theme);
|
|
|
|
}
|
|
|
|
|
2010-11-15 13:07:22 -08:00
|
|
|
int
|
|
|
|
main(int argc, char **argv)
|
|
|
|
{
|
|
|
|
/* TODO:
|
|
|
|
* - Add file monitor on files, so that we catch changes on files
|
|
|
|
* during whilst this program runs.
|
|
|
|
* - Maybe linger for a while to reduce number of cache re-creates.
|
|
|
|
*/
|
2010-12-08 13:39:43 -08:00
|
|
|
Eina_Iterator *it;
|
|
|
|
Efreet_Cache_Version *icon_version;
|
|
|
|
Efreet_Cache_Version *theme_version;
|
2011-01-31 03:44:24 -08:00
|
|
|
Efreet_Cache_Icon_Theme *theme;
|
|
|
|
Eet_Data_Descriptor *theme_edd;
|
2011-01-31 03:44:56 -08:00
|
|
|
Eet_Data_Descriptor *icon_edd;
|
|
|
|
Eet_Data_Descriptor *fallback_edd;
|
2010-12-08 13:39:43 -08:00
|
|
|
Eet_File *icon_ef;
|
|
|
|
Eet_File *theme_ef;
|
|
|
|
Eina_List *xdg_dirs = NULL;
|
2010-11-27 12:36:27 -08:00
|
|
|
Eina_List *l = NULL;
|
|
|
|
char file[PATH_MAX];
|
2010-11-29 05:17:33 -08:00
|
|
|
const char *path;
|
2010-11-27 12:36:27 -08:00
|
|
|
char *dir = NULL;
|
|
|
|
Eina_Bool changed = EINA_FALSE;
|
2011-03-23 13:02:46 -07:00
|
|
|
Eina_Bool flush = EINA_FALSE;
|
2010-11-27 12:36:27 -08:00
|
|
|
int lockfd = -1;
|
2011-01-31 03:44:35 -08:00
|
|
|
char **keys;
|
|
|
|
int num, i;
|
2010-11-27 12:36:27 -08:00
|
|
|
|
2011-02-02 14:58:15 -08:00
|
|
|
/* init external subsystems */
|
|
|
|
if (!eina_init()) return -1;
|
2011-03-18 13:00:22 -07:00
|
|
|
_efreet_icon_cache_log_dom =
|
|
|
|
eina_log_domain_register("efreet_icon_cache", EFREET_DEFAULT_LOG_COLOR);
|
2011-03-18 12:47:57 -07:00
|
|
|
if (_efreet_icon_cache_log_dom < 0)
|
|
|
|
{
|
|
|
|
EINA_LOG_ERR("Efreet: Could not create a log domain for efreet_icon_cache.");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
eina_log_domain_level_set("efreet_icon_cache", EINA_LOG_LEVEL_ERR);
|
2011-02-02 14:58:15 -08:00
|
|
|
|
|
|
|
exts = eina_array_new(10);
|
|
|
|
extra_dirs = eina_array_new(10);
|
|
|
|
|
2010-11-27 12:36:27 -08:00
|
|
|
for (i = 1; i < argc; i++)
|
|
|
|
{
|
2011-03-18 12:47:57 -07:00
|
|
|
if (!strcmp(argv[i], "-v"))
|
2011-03-18 13:00:22 -07:00
|
|
|
eina_log_domain_level_set("efreet_icon_cache", EINA_LOG_LEVEL_DBG);
|
2010-11-15 13:07:22 -08:00
|
|
|
else if ((!strcmp(argv[i], "-h")) ||
|
|
|
|
(!strcmp(argv[i], "-help")) ||
|
|
|
|
(!strcmp(argv[i], "--h")) ||
|
|
|
|
(!strcmp(argv[i], "--help")))
|
2010-11-27 12:36:27 -08:00
|
|
|
{
|
|
|
|
printf("Options:\n");
|
2011-02-02 14:58:15 -08:00
|
|
|
printf(" -v Verbose mode\n");
|
|
|
|
printf(" -e .ext1 .ext2 Extensions\n");
|
|
|
|
printf(" -d dir1 dir2 Extra dirs\n");
|
2012-11-01 18:46:44 -07:00
|
|
|
printf(" -f Flush\n");
|
2010-11-27 12:36:27 -08:00
|
|
|
exit(0);
|
|
|
|
}
|
2011-02-02 14:58:15 -08:00
|
|
|
else if (!strcmp(argv[i], "-e"))
|
|
|
|
{
|
|
|
|
while ((i < (argc - 1)) && (argv[(i + 1)][0] != '-'))
|
|
|
|
eina_array_push(exts, argv[++i]);
|
|
|
|
}
|
|
|
|
else if (!strcmp(argv[i], "-d"))
|
|
|
|
{
|
|
|
|
while ((i < (argc - 1)) && (argv[(i + 1)][0] != '-'))
|
|
|
|
eina_array_push(extra_dirs, argv[++i]);
|
|
|
|
}
|
2014-12-25 12:32:49 -08:00
|
|
|
else if (!strcmp(argv[i], "-f"))
|
2012-11-01 18:46:44 -07:00
|
|
|
flush = EINA_TRUE;
|
2011-02-02 14:58:15 -08:00
|
|
|
}
|
2010-11-27 12:36:27 -08:00
|
|
|
|
2013-07-11 02:22:38 -07:00
|
|
|
#ifdef HAVE_SYS_RESOURCE_H
|
2013-06-20 04:53:54 -07:00
|
|
|
setpriority(PRIO_PROCESS, 0, 19);
|
2013-07-11 12:10:51 -07:00
|
|
|
#elif _WIN32
|
|
|
|
SetPriorityClass(GetCurrentProcess(), IDLE_PRIORITY_CLASS);
|
2013-07-09 01:04:58 -07:00
|
|
|
#endif
|
|
|
|
|
2010-11-27 12:36:27 -08:00
|
|
|
if (!eet_init()) return -1;
|
|
|
|
if (!ecore_init()) return -1;
|
2010-11-15 13:07:22 -08:00
|
|
|
|
|
|
|
efreet_cache_update = 0;
|
2011-02-07 13:33:11 -08:00
|
|
|
/* finish efreet init */
|
|
|
|
if (!efreet_init()) goto on_error;
|
|
|
|
|
2010-11-29 05:17:33 -08:00
|
|
|
strs = eina_array_new(32);
|
2010-11-15 13:07:22 -08:00
|
|
|
|
|
|
|
/* create homedir */
|
2010-12-04 08:02:20 -08:00
|
|
|
snprintf(file, sizeof(file), "%s/efreet", efreet_cache_home_get());
|
2011-02-07 13:33:33 -08:00
|
|
|
if (!ecore_file_exists(file))
|
|
|
|
{
|
|
|
|
if (!ecore_file_mkpath(file)) return -1;
|
|
|
|
efreet_setowner(file);
|
|
|
|
}
|
2010-11-26 06:56:23 -08:00
|
|
|
|
2010-11-15 13:07:22 -08:00
|
|
|
/* lock process, so that we only run one copy of this program */
|
2010-11-26 06:56:23 -08:00
|
|
|
lockfd = cache_lock_file();
|
2011-02-07 13:33:11 -08:00
|
|
|
if (lockfd == -1) goto on_error;
|
2010-11-15 13:07:22 -08:00
|
|
|
|
2011-01-31 03:44:24 -08:00
|
|
|
/* Need to init edd's, so they are like we want, not like userspace wants */
|
2011-01-31 03:44:56 -08:00
|
|
|
icon_edd = efreet_icon_edd();
|
|
|
|
fallback_edd = efreet_icon_fallback_edd();
|
2011-01-31 03:44:24 -08:00
|
|
|
theme_edd = efreet_icon_theme_edd(EINA_TRUE);
|
2010-11-15 13:07:22 -08:00
|
|
|
|
2010-12-08 13:39:43 -08:00
|
|
|
icon_themes = eina_hash_string_superfast_new(EINA_FREE_CB(icon_theme_free));
|
|
|
|
|
2011-03-18 12:47:57 -07:00
|
|
|
INF("opening theme cache");
|
2010-12-08 13:39:43 -08:00
|
|
|
/* open theme file */
|
|
|
|
theme_ef = eet_open(efreet_icon_theme_cache_file(), EET_FILE_MODE_READ_WRITE);
|
|
|
|
if (!theme_ef) goto on_error_efreet;
|
|
|
|
theme_version = eet_data_read(theme_ef, efreet_version_edd(), EFREET_CACHE_VERSION);
|
|
|
|
if (theme_version &&
|
|
|
|
((theme_version->major != EFREET_ICON_CACHE_MAJOR) ||
|
|
|
|
(theme_version->minor != EFREET_ICON_CACHE_MINOR)))
|
2010-12-02 00:34:07 -08:00
|
|
|
{
|
|
|
|
// delete old cache
|
2010-12-08 13:39:43 -08:00
|
|
|
eet_close(theme_ef);
|
|
|
|
if (unlink(efreet_icon_theme_cache_file()) < 0)
|
2010-12-02 00:34:07 -08:00
|
|
|
{
|
|
|
|
if (errno != ENOENT) goto on_error_efreet;
|
|
|
|
}
|
2010-12-08 13:39:43 -08:00
|
|
|
theme_ef = eet_open(efreet_icon_theme_cache_file(), EET_FILE_MODE_READ_WRITE);
|
|
|
|
if (!theme_ef) goto on_error_efreet;
|
|
|
|
}
|
|
|
|
if (!theme_version)
|
|
|
|
theme_version = NEW(Efreet_Cache_Version, 1);
|
|
|
|
|
|
|
|
theme_version->major = EFREET_ICON_CACHE_MAJOR;
|
|
|
|
theme_version->minor = EFREET_ICON_CACHE_MINOR;
|
|
|
|
|
2011-08-16 05:46:24 -07:00
|
|
|
if (flush)
|
|
|
|
changed = EINA_TRUE;
|
2011-03-23 13:02:46 -07:00
|
|
|
|
|
|
|
if (exts->count == 0)
|
|
|
|
{
|
|
|
|
ERR("Need to pass extensions to icon cache create process");
|
|
|
|
goto on_error_efreet;
|
|
|
|
}
|
|
|
|
|
2011-01-31 03:44:35 -08:00
|
|
|
keys = eet_list(theme_ef, "*", &num);
|
|
|
|
if (keys)
|
|
|
|
{
|
|
|
|
for (i = 0; i < num; i++)
|
|
|
|
{
|
2011-01-31 03:44:46 -08:00
|
|
|
if (!strncmp(keys[i], "__efreet", 8)) continue;
|
2011-01-31 03:44:35 -08:00
|
|
|
theme = eet_data_read(theme_ef, theme_edd, keys[i]);
|
2012-08-04 10:11:18 -07:00
|
|
|
if (theme)
|
|
|
|
{
|
|
|
|
theme->valid = 0;
|
|
|
|
eina_hash_direct_add(icon_themes, theme->theme.name.internal, theme);
|
|
|
|
}
|
2011-01-31 03:44:35 -08:00
|
|
|
}
|
|
|
|
free(keys);
|
|
|
|
}
|
|
|
|
|
2011-03-18 12:47:57 -07:00
|
|
|
INF("scan for themes");
|
2010-12-08 13:39:43 -08:00
|
|
|
/* scan themes */
|
|
|
|
cache_theme_scan(efreet_icon_deprecated_user_dir_get());
|
|
|
|
cache_theme_scan(efreet_icon_user_dir_get());
|
|
|
|
|
|
|
|
xdg_dirs = efreet_data_dirs_get();
|
|
|
|
EINA_LIST_FOREACH(xdg_dirs, l, dir)
|
|
|
|
{
|
|
|
|
snprintf(file, sizeof(file), "%s/icons", dir);
|
|
|
|
cache_theme_scan(file);
|
2010-12-02 00:34:07 -08:00
|
|
|
}
|
|
|
|
|
2010-12-08 13:39:43 -08:00
|
|
|
#ifndef STRICT_SPEC
|
|
|
|
EINA_LIST_FOREACH(xdg_dirs, l, dir)
|
|
|
|
{
|
|
|
|
snprintf(file, sizeof(file), "%s/pixmaps", dir);
|
|
|
|
cache_theme_scan(file);
|
|
|
|
}
|
|
|
|
#endif
|
2010-11-26 06:56:23 -08:00
|
|
|
|
2020-04-16 05:03:45 -07:00
|
|
|
cache_theme_scan("/usr/local/share/pixmaps");
|
2010-12-08 13:39:43 -08:00
|
|
|
cache_theme_scan("/usr/share/pixmaps");
|
2010-11-26 06:56:23 -08:00
|
|
|
|
2010-12-08 13:39:43 -08:00
|
|
|
/* scan icons */
|
|
|
|
it = eina_hash_iterator_data_new(icon_themes);
|
|
|
|
EINA_ITERATOR_FOREACH(it, theme)
|
2010-11-27 12:36:27 -08:00
|
|
|
{
|
2011-01-31 03:44:56 -08:00
|
|
|
if (!theme->valid) continue;
|
2010-12-08 13:39:43 -08:00
|
|
|
#ifndef STRICT_SPEC
|
2011-01-31 03:44:24 -08:00
|
|
|
if (!theme->theme.name.name) continue;
|
2010-12-08 13:39:43 -08:00
|
|
|
#endif
|
2011-03-18 12:47:57 -07:00
|
|
|
INF("scan theme %s", theme->theme.name.name);
|
efreetd - cache - add more statinfo work around 0 mtime distros
some distros 9notably in this case nixos) want to do reproducible
builds. to them this means going around setting mtime for all files to
0. this means efreetd not only thinks mtime is invalid/stupid (0 is
generally just that as midnight on jan 1 1970 is not exactly a
sensible dare for a modified timestamp of a file as no filesystem with
any sanity will have not been modified since that time), but it keeps
mtime at 0 even when things update. this totally breaks efreetd that
expects to find mtime increases over time as things change. it's
necessary because it has to perform a "are mu caches up to date" scan
of all file data it caches and it needs to know if it should rebuild
something based on this.
so this does a few things:
1. it makes mtime have to be an exact match to the cache, not cache
mtime >= file mtime. so any change forward or back is an inavlidation.
2. it now also uses ctime, mode, size, uid, gid, block count and if a
symlink, the sha1 of the symlink path in addition and any change to
these == invalid.
this adds a lot of code and changes how dirs get scanned a bit but it
means it can pick up changes on these 0 mtime distros.
interestingly the policy of mtime being 0 is to have a reprodcible fs
... but ctime still changes and is > 0, as does inode info, so it's
not actually possible to have it totally work... but they try still,
so this is a fix for that problem.
whilst i was doing thisi also noticed efreetd re-red dirs many times
due to icon theme inhritance. i also fixed that to do a LOT less
syscalls by only scanning a dir once as i was rejigging the scanning
code at the time anyway. this should optimize thr scan costs at
efreetd startup too.
@fix
@opt
2020-06-18 03:03:02 -07:00
|
|
|
cache_theme_change_verify(theme);
|
2011-08-16 05:46:24 -07:00
|
|
|
theme->changed = check_changed(theme);
|
|
|
|
if (flush)
|
|
|
|
theme->changed = EINA_TRUE;
|
2010-11-27 12:36:27 -08:00
|
|
|
|
2011-03-18 12:47:57 -07:00
|
|
|
INF("open icon file");
|
2011-01-31 03:44:56 -08:00
|
|
|
/* open icon file */
|
|
|
|
icon_ef = eet_open(efreet_icon_cache_file(theme->theme.name.internal), EET_FILE_MODE_READ_WRITE);
|
|
|
|
if (!icon_ef) goto on_error_efreet;
|
|
|
|
icon_version = eet_data_read(icon_ef, efreet_version_edd(), EFREET_CACHE_VERSION);
|
2017-07-30 19:41:10 -07:00
|
|
|
if ((theme->changed) || (!icon_version) ||
|
2011-01-31 03:44:56 -08:00
|
|
|
((icon_version->major != EFREET_ICON_CACHE_MAJOR) ||
|
2017-07-30 19:41:10 -07:00
|
|
|
(icon_version->minor != EFREET_ICON_CACHE_MINOR)))
|
2010-11-27 12:36:27 -08:00
|
|
|
{
|
2011-01-31 03:44:56 -08:00
|
|
|
// delete old cache
|
|
|
|
eet_close(icon_ef);
|
|
|
|
if (unlink(efreet_icon_cache_file(theme->theme.name.internal)) < 0)
|
|
|
|
{
|
|
|
|
if (errno != ENOENT) goto on_error_efreet;
|
|
|
|
}
|
|
|
|
icon_ef = eet_open(efreet_icon_cache_file(theme->theme.name.internal), EET_FILE_MODE_READ_WRITE);
|
|
|
|
if (!icon_ef) goto on_error_efreet;
|
2011-08-16 05:46:24 -07:00
|
|
|
theme->changed = EINA_TRUE;
|
2011-01-31 03:44:56 -08:00
|
|
|
}
|
2010-11-29 05:17:33 -08:00
|
|
|
|
2011-03-08 03:41:18 -08:00
|
|
|
if (theme->changed)
|
|
|
|
changed = EINA_TRUE;
|
2010-11-29 05:17:33 -08:00
|
|
|
|
2012-10-10 13:28:05 -07:00
|
|
|
if (!icon_version)
|
|
|
|
icon_version = NEW(Efreet_Cache_Version, 1);
|
|
|
|
|
|
|
|
icon_version->major = EFREET_ICON_CACHE_MAJOR;
|
|
|
|
icon_version->minor = EFREET_ICON_CACHE_MINOR;
|
|
|
|
|
2011-08-16 05:46:24 -07:00
|
|
|
if (theme->changed)
|
2010-11-27 12:36:27 -08:00
|
|
|
{
|
2011-08-16 05:46:24 -07:00
|
|
|
Eina_Hash *themes;
|
|
|
|
Eina_Hash *icons;
|
|
|
|
|
|
|
|
themes = eina_hash_string_superfast_new(NULL);
|
|
|
|
icons = eina_hash_string_superfast_new(NULL);
|
|
|
|
|
|
|
|
INF("scan icons\n");
|
|
|
|
if (cache_scan(&(theme->theme), themes, icons))
|
2011-01-31 03:44:56 -08:00
|
|
|
{
|
|
|
|
Eina_Iterator *icons_it;
|
|
|
|
Eina_Hash_Tuple *tuple;
|
|
|
|
|
2011-08-16 05:46:24 -07:00
|
|
|
INF("generated: '%s' %i (%i)",
|
|
|
|
theme->theme.name.internal,
|
2012-11-01 18:46:44 -07:00
|
|
|
theme->changed,
|
2011-08-16 05:46:24 -07:00
|
|
|
eina_hash_population(icons));
|
|
|
|
|
2011-01-31 03:44:56 -08:00
|
|
|
icons_it = eina_hash_iterator_tuple_new(icons);
|
|
|
|
EINA_ITERATOR_FOREACH(icons_it, tuple)
|
efreetd - cache - add more statinfo work around 0 mtime distros
some distros 9notably in this case nixos) want to do reproducible
builds. to them this means going around setting mtime for all files to
0. this means efreetd not only thinks mtime is invalid/stupid (0 is
generally just that as midnight on jan 1 1970 is not exactly a
sensible dare for a modified timestamp of a file as no filesystem with
any sanity will have not been modified since that time), but it keeps
mtime at 0 even when things update. this totally breaks efreetd that
expects to find mtime increases over time as things change. it's
necessary because it has to perform a "are mu caches up to date" scan
of all file data it caches and it needs to know if it should rebuild
something based on this.
so this does a few things:
1. it makes mtime have to be an exact match to the cache, not cache
mtime >= file mtime. so any change forward or back is an inavlidation.
2. it now also uses ctime, mode, size, uid, gid, block count and if a
symlink, the sha1 of the symlink path in addition and any change to
these == invalid.
this adds a lot of code and changes how dirs get scanned a bit but it
means it can pick up changes on these 0 mtime distros.
interestingly the policy of mtime being 0 is to have a reprodcible fs
... but ctime still changes and is > 0, as does inode info, so it's
not actually possible to have it totally work... but they try still,
so this is a fix for that problem.
whilst i was doing thisi also noticed efreetd re-red dirs many times
due to icon theme inhritance. i also fixed that to do a LOT less
syscalls by only scanning a dir once as i was rejigging the scanning
code at the time anyway. this should optimize thr scan costs at
efreetd startup too.
@fix
@opt
2020-06-18 03:03:02 -07:00
|
|
|
eet_data_write(icon_ef, icon_edd, tuple->key, tuple->data, EET_COMPRESSION_SUPERFAST);
|
2011-01-31 03:44:56 -08:00
|
|
|
eina_iterator_free(icons_it);
|
2010-12-08 13:39:43 -08:00
|
|
|
|
efreetd - cache - add more statinfo work around 0 mtime distros
some distros 9notably in this case nixos) want to do reproducible
builds. to them this means going around setting mtime for all files to
0. this means efreetd not only thinks mtime is invalid/stupid (0 is
generally just that as midnight on jan 1 1970 is not exactly a
sensible dare for a modified timestamp of a file as no filesystem with
any sanity will have not been modified since that time), but it keeps
mtime at 0 even when things update. this totally breaks efreetd that
expects to find mtime increases over time as things change. it's
necessary because it has to perform a "are mu caches up to date" scan
of all file data it caches and it needs to know if it should rebuild
something based on this.
so this does a few things:
1. it makes mtime have to be an exact match to the cache, not cache
mtime >= file mtime. so any change forward or back is an inavlidation.
2. it now also uses ctime, mode, size, uid, gid, block count and if a
symlink, the sha1 of the symlink path in addition and any change to
these == invalid.
this adds a lot of code and changes how dirs get scanned a bit but it
means it can pick up changes on these 0 mtime distros.
interestingly the policy of mtime being 0 is to have a reprodcible fs
... but ctime still changes and is > 0, as does inode info, so it's
not actually possible to have it totally work... but they try still,
so this is a fix for that problem.
whilst i was doing thisi also noticed efreetd re-red dirs many times
due to icon theme inhritance. i also fixed that to do a LOT less
syscalls by only scanning a dir once as i was rejigging the scanning
code at the time anyway. this should optimize thr scan costs at
efreetd startup too.
@fix
@opt
2020-06-18 03:03:02 -07:00
|
|
|
INF("theme change: %s %lld", theme->theme.name.internal, theme->check.mtime);
|
|
|
|
eet_data_write(theme_ef, theme_edd, theme->theme.name.internal, theme, EET_COMPRESSION_SUPERFAST);
|
2011-08-16 05:46:24 -07:00
|
|
|
}
|
|
|
|
eina_hash_free(themes);
|
|
|
|
eina_hash_free(icons);
|
2012-11-01 18:46:44 -07:00
|
|
|
changed = EINA_TRUE;
|
2011-01-31 03:44:56 -08:00
|
|
|
}
|
|
|
|
|
efreetd - cache - add more statinfo work around 0 mtime distros
some distros 9notably in this case nixos) want to do reproducible
builds. to them this means going around setting mtime for all files to
0. this means efreetd not only thinks mtime is invalid/stupid (0 is
generally just that as midnight on jan 1 1970 is not exactly a
sensible dare for a modified timestamp of a file as no filesystem with
any sanity will have not been modified since that time), but it keeps
mtime at 0 even when things update. this totally breaks efreetd that
expects to find mtime increases over time as things change. it's
necessary because it has to perform a "are mu caches up to date" scan
of all file data it caches and it needs to know if it should rebuild
something based on this.
so this does a few things:
1. it makes mtime have to be an exact match to the cache, not cache
mtime >= file mtime. so any change forward or back is an inavlidation.
2. it now also uses ctime, mode, size, uid, gid, block count and if a
symlink, the sha1 of the symlink path in addition and any change to
these == invalid.
this adds a lot of code and changes how dirs get scanned a bit but it
means it can pick up changes on these 0 mtime distros.
interestingly the policy of mtime being 0 is to have a reprodcible fs
... but ctime still changes and is > 0, as does inode info, so it's
not actually possible to have it totally work... but they try still,
so this is a fix for that problem.
whilst i was doing thisi also noticed efreetd re-red dirs many times
due to icon theme inhritance. i also fixed that to do a LOT less
syscalls by only scanning a dir once as i was rejigging the scanning
code at the time anyway. this should optimize thr scan costs at
efreetd startup too.
@fix
@opt
2020-06-18 03:03:02 -07:00
|
|
|
eet_data_write(icon_ef, efreet_version_edd(), EFREET_CACHE_VERSION, icon_version, EET_COMPRESSION_SUPERFAST);
|
2011-01-31 03:44:56 -08:00
|
|
|
eet_close(icon_ef);
|
2011-02-07 13:33:33 -08:00
|
|
|
efreet_setowner(efreet_icon_cache_file(theme->theme.name.internal));
|
2011-01-31 03:44:56 -08:00
|
|
|
free(icon_version);
|
2010-11-16 02:32:21 -08:00
|
|
|
}
|
2010-12-08 13:39:43 -08:00
|
|
|
eina_iterator_free(it);
|
2010-11-16 02:32:21 -08:00
|
|
|
|
2011-08-16 05:46:24 -07:00
|
|
|
INF("scan fallback icons");
|
|
|
|
theme = eet_data_read(theme_ef, theme_edd, EFREET_CACHE_ICON_FALLBACK);
|
|
|
|
if (!theme)
|
|
|
|
{
|
|
|
|
theme = NEW(Efreet_Cache_Icon_Theme, 1);
|
|
|
|
theme->changed = EINA_TRUE;
|
|
|
|
}
|
|
|
|
if (flush)
|
|
|
|
theme->changed = EINA_TRUE;
|
2011-02-22 04:52:58 -08:00
|
|
|
|
2011-03-18 12:47:57 -07:00
|
|
|
INF("open fallback file");
|
2011-01-31 03:44:56 -08:00
|
|
|
/* open icon file */
|
|
|
|
icon_ef = eet_open(efreet_icon_cache_file(EFREET_CACHE_ICON_FALLBACK), EET_FILE_MODE_READ_WRITE);
|
|
|
|
if (!icon_ef) goto on_error_efreet;
|
|
|
|
icon_version = eet_data_read(icon_ef, efreet_version_edd(), EFREET_CACHE_VERSION);
|
2011-08-16 05:46:24 -07:00
|
|
|
if (theme->changed || (icon_version &&
|
2011-01-31 03:44:56 -08:00
|
|
|
((icon_version->major != EFREET_ICON_CACHE_MAJOR) ||
|
2011-03-23 13:02:46 -07:00
|
|
|
(icon_version->minor != EFREET_ICON_CACHE_MINOR))))
|
2010-11-27 12:36:27 -08:00
|
|
|
{
|
2011-01-31 03:44:56 -08:00
|
|
|
// delete old cache
|
|
|
|
eet_close(icon_ef);
|
|
|
|
if (unlink(efreet_icon_cache_file(EFREET_CACHE_ICON_FALLBACK)) < 0)
|
|
|
|
{
|
|
|
|
if (errno != ENOENT) goto on_error_efreet;
|
|
|
|
}
|
|
|
|
icon_ef = eet_open(efreet_icon_cache_file(EFREET_CACHE_ICON_FALLBACK), EET_FILE_MODE_READ_WRITE);
|
|
|
|
if (!icon_ef) goto on_error_efreet;
|
2011-08-16 05:46:24 -07:00
|
|
|
theme->changed = EINA_TRUE;
|
2011-01-31 03:44:56 -08:00
|
|
|
}
|
2011-08-16 05:46:24 -07:00
|
|
|
if (!theme->changed)
|
|
|
|
theme->changed = check_fallback_changed(theme);
|
|
|
|
if (theme->changed && theme->dirs)
|
2011-02-02 14:58:15 -08:00
|
|
|
{
|
|
|
|
efreet_hash_free(theme->dirs, free);
|
|
|
|
theme->dirs = NULL;
|
|
|
|
}
|
2011-01-31 03:44:35 -08:00
|
|
|
if (!theme->dirs)
|
|
|
|
theme->dirs = eina_hash_string_superfast_new(NULL);
|
2010-11-29 05:17:33 -08:00
|
|
|
|
2011-08-16 05:46:24 -07:00
|
|
|
if (theme->changed)
|
|
|
|
changed = EINA_TRUE;
|
|
|
|
|
2012-10-10 13:28:05 -07:00
|
|
|
if (!icon_version)
|
|
|
|
icon_version = NEW(Efreet_Cache_Version, 1);
|
|
|
|
|
|
|
|
icon_version->major = EFREET_ICON_CACHE_MAJOR;
|
|
|
|
icon_version->minor = EFREET_ICON_CACHE_MINOR;
|
|
|
|
|
2011-08-16 05:46:24 -07:00
|
|
|
if (theme->changed)
|
2010-11-27 12:36:27 -08:00
|
|
|
{
|
2011-08-16 05:46:24 -07:00
|
|
|
Eina_Hash *icons;
|
|
|
|
|
|
|
|
icons = eina_hash_string_superfast_new(NULL);
|
|
|
|
|
|
|
|
INF("scan fallback icons");
|
|
|
|
/* Save fallback in the right part */
|
|
|
|
if (cache_fallback_scan(icons, theme->dirs))
|
2011-01-31 03:44:56 -08:00
|
|
|
{
|
|
|
|
Eina_Iterator *icons_it;
|
|
|
|
Eina_Hash_Tuple *tuple;
|
2010-11-15 13:07:22 -08:00
|
|
|
|
2011-08-16 05:46:24 -07:00
|
|
|
INF("generated: fallback %i (%i)", theme->changed, eina_hash_population(icons));
|
|
|
|
|
2011-01-31 03:44:56 -08:00
|
|
|
icons_it = eina_hash_iterator_tuple_new(icons);
|
|
|
|
EINA_ITERATOR_FOREACH(icons_it, tuple)
|
efreetd - cache - add more statinfo work around 0 mtime distros
some distros 9notably in this case nixos) want to do reproducible
builds. to them this means going around setting mtime for all files to
0. this means efreetd not only thinks mtime is invalid/stupid (0 is
generally just that as midnight on jan 1 1970 is not exactly a
sensible dare for a modified timestamp of a file as no filesystem with
any sanity will have not been modified since that time), but it keeps
mtime at 0 even when things update. this totally breaks efreetd that
expects to find mtime increases over time as things change. it's
necessary because it has to perform a "are mu caches up to date" scan
of all file data it caches and it needs to know if it should rebuild
something based on this.
so this does a few things:
1. it makes mtime have to be an exact match to the cache, not cache
mtime >= file mtime. so any change forward or back is an inavlidation.
2. it now also uses ctime, mode, size, uid, gid, block count and if a
symlink, the sha1 of the symlink path in addition and any change to
these == invalid.
this adds a lot of code and changes how dirs get scanned a bit but it
means it can pick up changes on these 0 mtime distros.
interestingly the policy of mtime being 0 is to have a reprodcible fs
... but ctime still changes and is > 0, as does inode info, so it's
not actually possible to have it totally work... but they try still,
so this is a fix for that problem.
whilst i was doing thisi also noticed efreetd re-red dirs many times
due to icon theme inhritance. i also fixed that to do a LOT less
syscalls by only scanning a dir once as i was rejigging the scanning
code at the time anyway. this should optimize thr scan costs at
efreetd startup too.
@fix
@opt
2020-06-18 03:03:02 -07:00
|
|
|
eet_data_write(icon_ef, fallback_edd, tuple->key, tuple->data, EET_COMPRESSION_SUPERFAST);
|
2011-01-31 03:44:56 -08:00
|
|
|
eina_iterator_free(icons_it);
|
|
|
|
}
|
2011-08-16 05:46:24 -07:00
|
|
|
eina_hash_free(icons);
|
|
|
|
|
efreetd - cache - add more statinfo work around 0 mtime distros
some distros 9notably in this case nixos) want to do reproducible
builds. to them this means going around setting mtime for all files to
0. this means efreetd not only thinks mtime is invalid/stupid (0 is
generally just that as midnight on jan 1 1970 is not exactly a
sensible dare for a modified timestamp of a file as no filesystem with
any sanity will have not been modified since that time), but it keeps
mtime at 0 even when things update. this totally breaks efreetd that
expects to find mtime increases over time as things change. it's
necessary because it has to perform a "are mu caches up to date" scan
of all file data it caches and it needs to know if it should rebuild
something based on this.
so this does a few things:
1. it makes mtime have to be an exact match to the cache, not cache
mtime >= file mtime. so any change forward or back is an inavlidation.
2. it now also uses ctime, mode, size, uid, gid, block count and if a
symlink, the sha1 of the symlink path in addition and any change to
these == invalid.
this adds a lot of code and changes how dirs get scanned a bit but it
means it can pick up changes on these 0 mtime distros.
interestingly the policy of mtime being 0 is to have a reprodcible fs
... but ctime still changes and is > 0, as does inode info, so it's
not actually possible to have it totally work... but they try still,
so this is a fix for that problem.
whilst i was doing thisi also noticed efreetd re-red dirs many times
due to icon theme inhritance. i also fixed that to do a LOT less
syscalls by only scanning a dir once as i was rejigging the scanning
code at the time anyway. this should optimize thr scan costs at
efreetd startup too.
@fix
@opt
2020-06-18 03:03:02 -07:00
|
|
|
eet_data_write(theme_ef, theme_edd, EFREET_CACHE_ICON_FALLBACK, theme, EET_COMPRESSION_SUPERFAST);
|
2011-01-31 03:44:56 -08:00
|
|
|
}
|
2010-11-26 06:56:23 -08:00
|
|
|
|
2011-01-31 03:44:56 -08:00
|
|
|
icon_theme_free(theme);
|
2010-12-08 13:39:43 -08:00
|
|
|
|
efreetd - cache - add more statinfo work around 0 mtime distros
some distros 9notably in this case nixos) want to do reproducible
builds. to them this means going around setting mtime for all files to
0. this means efreetd not only thinks mtime is invalid/stupid (0 is
generally just that as midnight on jan 1 1970 is not exactly a
sensible dare for a modified timestamp of a file as no filesystem with
any sanity will have not been modified since that time), but it keeps
mtime at 0 even when things update. this totally breaks efreetd that
expects to find mtime increases over time as things change. it's
necessary because it has to perform a "are mu caches up to date" scan
of all file data it caches and it needs to know if it should rebuild
something based on this.
so this does a few things:
1. it makes mtime have to be an exact match to the cache, not cache
mtime >= file mtime. so any change forward or back is an inavlidation.
2. it now also uses ctime, mode, size, uid, gid, block count and if a
symlink, the sha1 of the symlink path in addition and any change to
these == invalid.
this adds a lot of code and changes how dirs get scanned a bit but it
means it can pick up changes on these 0 mtime distros.
interestingly the policy of mtime being 0 is to have a reprodcible fs
... but ctime still changes and is > 0, as does inode info, so it's
not actually possible to have it totally work... but they try still,
so this is a fix for that problem.
whilst i was doing thisi also noticed efreetd re-red dirs many times
due to icon theme inhritance. i also fixed that to do a LOT less
syscalls by only scanning a dir once as i was rejigging the scanning
code at the time anyway. this should optimize thr scan costs at
efreetd startup too.
@fix
@opt
2020-06-18 03:03:02 -07:00
|
|
|
eet_data_write(icon_ef, efreet_version_edd(), EFREET_CACHE_VERSION, icon_version, EET_COMPRESSION_SUPERFAST);
|
2010-12-08 13:39:43 -08:00
|
|
|
eet_close(icon_ef);
|
2011-02-07 13:33:33 -08:00
|
|
|
efreet_setowner(efreet_icon_cache_file(EFREET_CACHE_ICON_FALLBACK));
|
2010-12-08 13:39:43 -08:00
|
|
|
free(icon_version);
|
2011-01-31 03:44:56 -08:00
|
|
|
|
|
|
|
eina_hash_free(icon_themes);
|
|
|
|
|
|
|
|
/* save data */
|
efreetd - cache - add more statinfo work around 0 mtime distros
some distros 9notably in this case nixos) want to do reproducible
builds. to them this means going around setting mtime for all files to
0. this means efreetd not only thinks mtime is invalid/stupid (0 is
generally just that as midnight on jan 1 1970 is not exactly a
sensible dare for a modified timestamp of a file as no filesystem with
any sanity will have not been modified since that time), but it keeps
mtime at 0 even when things update. this totally breaks efreetd that
expects to find mtime increases over time as things change. it's
necessary because it has to perform a "are mu caches up to date" scan
of all file data it caches and it needs to know if it should rebuild
something based on this.
so this does a few things:
1. it makes mtime have to be an exact match to the cache, not cache
mtime >= file mtime. so any change forward or back is an inavlidation.
2. it now also uses ctime, mode, size, uid, gid, block count and if a
symlink, the sha1 of the symlink path in addition and any change to
these == invalid.
this adds a lot of code and changes how dirs get scanned a bit but it
means it can pick up changes on these 0 mtime distros.
interestingly the policy of mtime being 0 is to have a reprodcible fs
... but ctime still changes and is > 0, as does inode info, so it's
not actually possible to have it totally work... but they try still,
so this is a fix for that problem.
whilst i was doing thisi also noticed efreetd re-red dirs many times
due to icon theme inhritance. i also fixed that to do a LOT less
syscalls by only scanning a dir once as i was rejigging the scanning
code at the time anyway. this should optimize thr scan costs at
efreetd startup too.
@fix
@opt
2020-06-18 03:03:02 -07:00
|
|
|
eet_data_write(theme_ef, efreet_version_edd(), EFREET_CACHE_VERSION, theme_version, EET_COMPRESSION_SUPERFAST);
|
2011-03-23 13:02:46 -07:00
|
|
|
|
2010-12-08 13:39:43 -08:00
|
|
|
eet_close(theme_ef);
|
2015-12-16 10:39:33 -08:00
|
|
|
theme_ef = NULL;
|
2011-02-07 13:33:33 -08:00
|
|
|
efreet_setowner(efreet_icon_theme_cache_file());
|
2010-12-08 13:39:43 -08:00
|
|
|
free(theme_version);
|
2010-11-26 06:56:23 -08:00
|
|
|
|
2011-02-22 04:42:46 -08:00
|
|
|
{
|
2011-08-16 05:46:35 -07:00
|
|
|
char c = 'n';
|
|
|
|
|
|
|
|
if (changed) c = 'c';
|
2012-10-20 21:53:23 -07:00
|
|
|
printf("%c\n", c);
|
2011-02-22 04:42:46 -08:00
|
|
|
}
|
2010-12-02 00:33:57 -08:00
|
|
|
|
2011-03-18 12:47:57 -07:00
|
|
|
INF("done");
|
2010-11-27 12:36:27 -08:00
|
|
|
on_error_efreet:
|
2010-11-15 13:07:22 -08:00
|
|
|
efreet_shutdown();
|
2012-10-10 13:28:47 -07:00
|
|
|
if (theme_ef) eet_close(theme_ef);
|
2010-11-26 06:56:23 -08:00
|
|
|
|
2010-11-27 12:36:27 -08:00
|
|
|
on_error:
|
2011-02-09 09:09:49 -08:00
|
|
|
if (lockfd >= 0) close(lockfd);
|
2010-11-26 06:56:23 -08:00
|
|
|
|
2010-11-29 05:17:33 -08:00
|
|
|
while ((path = eina_array_pop(strs)))
|
2010-11-30 10:41:21 -08:00
|
|
|
eina_stringshare_del(path);
|
2010-11-29 05:17:33 -08:00
|
|
|
eina_array_free(strs);
|
2011-02-02 14:58:15 -08:00
|
|
|
eina_array_free(exts);
|
|
|
|
eina_array_free(extra_dirs);
|
2010-11-29 05:17:33 -08:00
|
|
|
|
2010-11-23 08:49:46 -08:00
|
|
|
ecore_shutdown();
|
2010-11-15 13:07:22 -08:00
|
|
|
eet_shutdown();
|
2011-03-18 13:00:22 -07:00
|
|
|
eina_log_domain_unregister(_efreet_icon_cache_log_dom);
|
2010-11-15 13:07:22 -08:00
|
|
|
eina_shutdown();
|
2010-11-26 06:56:23 -08:00
|
|
|
|
|
|
|
return 0;
|
2010-11-15 13:07:22 -08:00
|
|
|
}
|