Enlightenment CVS committal
Author : sebastid
Project : e17
Module : libs/ecore
Dir : e17/libs/ecore/src/lib/ecore_file
Modified Files:
ecore_file_path.c
Log Message:
Strip arguments
===================================================================
RCS file:
/cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_file/ecore_file_path.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- ecore_file_path.c 28 Sep 2005 01:28:22 -0000 1.5
+++ ecore_file_path.c 28 Sep 2005 02:08:52 -0000 1.6
@@ -62,11 +62,11 @@
{
char *dir;
char buf[PATH_MAX];
+ char *file, *p;
if (!app) return 0;
if (ecore_file_exists(app) && ecore_file_can_exec(app)) return 1;
- if (ecore_list_is_empty(__ecore_file_path_bin)) return 0;
ecore_list_goto_first(__ecore_file_path_bin);
while ((dir = ecore_list_next(__ecore_file_path_bin)) != NULL)
{
@@ -75,5 +75,30 @@
return 1;
}
+ /* Maybe the app has arguments */
+ file = strdup(app);
+ if (!file) return 0;
+ p = strchr(file, ' ');
+ if (!p)
+ p = strchr(file, '\t');
+ if (!p)
+ p = strchr(file, '\n');
+ if (p)
+ {
+ *p = '\0';
+ if (ecore_file_exists(file) && ecore_file_can_exec(file)) return 1;
+ ecore_list_goto_first(__ecore_file_path_bin);
+ while ((dir = ecore_list_next(__ecore_file_path_bin)) != NULL)
+ {
+ snprintf(buf, sizeof(buf), "%s/%s", dir, file);
+ if (ecore_file_exists(buf) && ecore_file_can_exec(buf))
+ {
+ free(file);
+ return 1;
+ }
+ }
+ }
+ free(file);
+
return 0;
}
-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs