Enlightenment CVS committal

Author  : raster
Project : e17
Module  : libs/ecore

Dir     : e17/libs/ecore/src/lib/ecore_file


Modified Files:
        Ecore_File.h ecore_file_path.c 


Log Message:


another util function - list all executables in your $PATH - in full.

===================================================================
RCS file: 
/cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_file/Ecore_File.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -3 -r1.19 -r1.20
--- Ecore_File.h        1 Dec 2005 06:23:58 -0000       1.19
+++ Ecore_File.h        7 Dec 2005 07:18:52 -0000       1.20
@@ -82,7 +82,8 @@
    EAPI const char *ecore_file_monitor_path_get(Ecore_File_Monitor 
*ecore_file_monitor);
 
    EAPI int         ecore_file_app_installed(const char *exe);
-
+   EAPI Ecore_List *ecore_file_app_list(void);
+       
    EAPI int         ecore_file_download(const char *url, const char *dst,
                                        void (*completion_cb)(void *data,
                                                              const char *file,
===================================================================
RCS file: 
/cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_file/ecore_file_path.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -3 -r1.15 -r1.16
--- ecore_file_path.c   3 Oct 2005 18:25:22 -0000       1.15
+++ ecore_file_path.c   7 Dec 2005 07:18:52 -0000       1.16
@@ -74,3 +74,32 @@
      }
    return 0;
 }
+
+Ecore_List *
+ecore_file_app_list(void)
+{
+   Ecore_List *list, *files;
+   char  buf[PATH_MAX], *dir, *exe;
+   
+   list = ecore_list_new();
+   if (!list) return NULL;
+   ecore_list_set_free_cb(list, free);
+   ecore_list_goto_first(__ecore_file_path_bin);
+   while ((dir = ecore_list_next(__ecore_file_path_bin)) != NULL)
+     {
+       files = ecore_file_ls(dir);
+       if (files)
+         {
+            ecore_list_goto_first(files);
+            while ((exe = ecore_list_next(files)) != NULL)
+              {
+                 snprintf(buf, sizeof(buf), "%s/%s", dir, exe);
+                 if ((ecore_file_can_exec(buf)) &&
+                     (!ecore_file_is_dir(buf)))
+                   ecore_list_append(list, strdup(buf));
+              }
+            ecore_list_destroy(files);
+         }
+     }
+   return list;
+}




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to