Link Here
|
|
|
1 |
--- menu-cache-daemon/menu-cached.c.orig 2012-11-14 09:07:36.000000000 +0100 |
2 |
+++ menu-cache-daemon/menu-cached.c 2013-07-01 00:02:26.000000000 +0200 |
3 |
@@ -121,7 +121,7 @@ |
4 |
static gboolean read_all_used_files( FILE* f, int* n_files, char*** used_files ) |
5 |
{ |
6 |
char line[ 4096 ]; |
7 |
- int i, n; |
8 |
+ int i, n, x; |
9 |
char** files; |
10 |
int ver_maj, ver_min; |
11 |
|
12 |
@@ -141,20 +141,31 @@ |
13 |
if( ! fgets( line, G_N_ELEMENTS(line), f ) ) |
14 |
return FALSE; |
15 |
|
16 |
- *n_files = n = atoi( line ); |
17 |
+ n = atoi( line ); |
18 |
files = g_new0( char*, n + 1 ); |
19 |
|
20 |
- for( i = 0; i < n; ++i ) |
21 |
+ for( i = 0, x = 0; i < n; ++i ) |
22 |
{ |
23 |
int len; |
24 |
+ GFile *gfile; |
25 |
if( ! fgets( line, G_N_ELEMENTS(line), f ) ) |
26 |
return FALSE; |
27 |
|
28 |
len = strlen( line ); |
29 |
if( len <= 1 ) |
30 |
return FALSE; |
31 |
- files[ i ] = g_strndup( line, len - 1 ); /* don't include \n */ |
32 |
+ files[ x ] = g_strndup( line, len - 1 ); /* don't include \n */ |
33 |
+ gfile = g_file_new_for_path(files[x]+1); |
34 |
+ if (g_file_query_exists(gfile, NULL)) |
35 |
+ x++; |
36 |
+ else |
37 |
+ { |
38 |
+ DEBUG("ignoring not existant file from menu-cache-gen: %s", files[x]); |
39 |
+ g_free(files[x]); |
40 |
+ } |
41 |
+ g_object_unref(gfile); |
42 |
} |
43 |
+ *n_files = x; |
44 |
*used_files = files; |
45 |
return TRUE; |
46 |
} |