|
|
@@ -49,6 +49,7 @@ chercher_una (GMatchInfo *match_info,
|
|
|
OupisWindow *window)
|
|
|
{
|
|
|
const gchar* procdir = "/home/vetetix/Code/Gendarmerie/Oupis/procedures";
|
|
|
+ //const gchar* procdir = "/run/user/1000/gvfs/dav:host=cloud.arnoux.lu,ssl=true,prefix=%2Fremote.php%2Fdav%2Ffiles%2Fthomas/LRPGN/procedures";
|
|
|
//gchar proctype[][6];
|
|
|
GDateTime *now;
|
|
|
gint year;
|
|
|
@@ -85,8 +86,8 @@ chercher_una (GMatchInfo *match_info,
|
|
|
g_autoptr (GFileInfo) info;
|
|
|
g_autoptr (GFile) file;
|
|
|
GError *error = NULL;
|
|
|
- gchar* infoname;
|
|
|
- gchar* infoname_lc_ascii;
|
|
|
+ const gchar* infoname;
|
|
|
+ const gchar* infoname_lc_ascii;
|
|
|
int i=0;
|
|
|
for (i=0; i < g_strv_length (proctype); i++ ) {
|
|
|
category_dir = g_file_new_build_filename (procdir,
|
|
|
@@ -95,11 +96,17 @@ chercher_una (GMatchInfo *match_info,
|
|
|
g_print ("%s\n", g_file_get_path (category_dir));
|
|
|
|
|
|
//TODO rendre async et gérer les erreurs
|
|
|
- direnum = g_file_enumerate_children (category_dir,
|
|
|
- "standard::name,standard::display-name,standard::type",
|
|
|
- G_FILE_QUERY_INFO_NONE,
|
|
|
- NULL,
|
|
|
- &error);
|
|
|
+ //TODO s'assurer que c'est bien un dossier
|
|
|
+ if (g_file_query_exists (category_dir, NULL)) {
|
|
|
+ direnum = g_file_enumerate_children (category_dir,
|
|
|
+ "standard::name,standard::display-name,standard::type",
|
|
|
+ G_FILE_QUERY_INFO_NONE,
|
|
|
+ NULL,
|
|
|
+ &error);
|
|
|
+ } else {
|
|
|
+ g_print ("Dossier non trouvé: %s\n", g_file_get_path (category_dir));
|
|
|
+ }
|
|
|
+
|
|
|
if (error) {
|
|
|
g_print("%s\n", error->message);
|
|
|
error = NULL;
|
|
|
@@ -114,6 +121,7 @@ chercher_una (GMatchInfo *match_info,
|
|
|
break;
|
|
|
g_print ("%s\n", g_file_get_path (file));
|
|
|
infoname = g_file_info_get_name (info);
|
|
|
+ g_print ("%s\n", infoname);
|
|
|
/*infoname_lc_ascii = str_to_lc_ascii (infoname);
|
|
|
|
|
|
if (g_strrstr (infoname_lc_ascii, request_lc_ascii)) {
|
|
|
@@ -132,7 +140,8 @@ chercher_una (GMatchInfo *match_info,
|
|
|
//g_object_unref (direnum); // Note: frees the last @info
|
|
|
|
|
|
}
|
|
|
- g_error_free (error);
|
|
|
+ if (error)
|
|
|
+ g_error_free (error);
|
|
|
|
|
|
now = g_date_time_new_now_local ();
|
|
|
year = g_date_time_get_year (now);
|