*Only put the E_App in the hash after it has passed all tests.

Thanks to metrics for helping to debug this.

*It's not a white space argument between raster and I, it's an arguement
between our respective editors.  His is the only editor that can handle
odd number of spaces indentation, mine keeps trying to convert it to 4
or 8 character tabs.  Sorry for the noisy white space stuff in this commit.


SVN revision: 26241
This commit is contained in:
David Walter Seikel 2006-09-30 16:59:17 +00:00
parent 9ff6bf18d4
commit 50bb66fe29
1 changed files with 39 additions and 36 deletions

View File

@ -320,6 +320,7 @@ e_app_new(const char *path, int scan_subdirs)
E_App *a; E_App *a;
struct stat st; struct stat st;
int stated = 0; int stated = 0;
int new_app = 0;
char buf[PATH_MAX]; char buf[PATH_MAX];
if (!path) return NULL; if (!path) return NULL;
@ -350,45 +351,44 @@ e_app_new(const char *path, int scan_subdirs)
if ((!a) && (ecore_file_exists(path))) if ((!a) && (ecore_file_exists(path)))
{ {
/* Create it and add it to the cache. */ /* Create it. */
a = e_app_empty_new(path); a = e_app_empty_new(path);
if (a) new_app = 1;
_e_apps_every_app = evas_hash_direct_add(_e_apps_every_app, a->path, a);
} }
if ((a) && (a->path)) if ((a) && (a->path))
{ {
if (ecore_file_is_dir(a->path)) if (ecore_file_is_dir(a->path))
{ {
if (!a->filled) if (!a->filled)
{ {
snprintf(buf, sizeof(buf), "%s/.directory.eap", path); snprintf(buf, sizeof(buf), "%s/.directory.eap", path);
if (ecore_file_exists(buf)) if (ecore_file_exists(buf))
e_app_fields_fill(a, buf); e_app_fields_fill(a, buf);
else else
{ {
a->name = evas_stringshare_add(ecore_file_get_file(a->path)); a->name = evas_stringshare_add(ecore_file_get_file(a->path));
a->filled = 1; a->filled = 1;
} }
} }
if (!a->filled) goto error; if (!a->filled) goto error;
if (scan_subdirs) if (scan_subdirs)
{ {
if (stated) if (stated)
_e_app_subdir_rescan(a); _e_app_subdir_rescan(a);
else else
e_app_subdir_scan(a, scan_subdirs); e_app_subdir_scan(a, scan_subdirs);
} }
/* Don't monitor the all directory, all changes to that must go through e_app. */ /* Don't monitor the all directory, all changes to that must go through e_app. */
if ((!stated) && (strcmp(_e_apps_path_all, a->path) != 0)) if ((!stated) && (strcmp(_e_apps_path_all, a->path) != 0))
a->monitor = ecore_file_monitor_add(a->path, _e_app_cb_monitor, a); a->monitor = ecore_file_monitor_add(a->path, _e_app_cb_monitor, a);
} }
else if (_e_app_is_eapp(a->path)) else if (_e_app_is_eapp(a->path))
{ {
if (!a->filled) if (!a->filled)
e_app_fields_fill(a, a->path); e_app_fields_fill(a, a->path);
_e_apps_hash_cb_init(_e_apps_every_app, a->path, a, NULL); _e_apps_hash_cb_init(_e_apps_every_app, a->path, a, NULL);
/* no exe field.. not valid. drop it */ /* no exe field.. not valid. drop it */
// if (!_e_app_exe_valid_get(a->exe)) // if (!_e_app_exe_valid_get(a->exe))
@ -397,6 +397,9 @@ e_app_new(const char *path, int scan_subdirs)
else else
goto error; goto error;
if (new_app)
_e_apps_every_app = evas_hash_direct_add(_e_apps_every_app, a->path, a);
/* Timestamp the cache, and no need to stat the file twice if the cache was stale. */ /* Timestamp the cache, and no need to stat the file twice if the cache was stale. */
if ((stated) || (stat(a->path, &st) >= 0)) if ((stated) || (stat(a->path, &st) >= 0))
{ {