normalize away spurious percent arguments in the executable
authorViktor Kojouharov <vkojouharov@gmail.com>
Sat, 21 Mar 2009 11:48:45 +0000 (11:48 +0000)
committerViktor Kojouharov <vkojouharov@gmail.com>
Sat, 21 Mar 2009 11:48:45 +0000 (11:48 +0000)
SVN revision: 39608

src/bin/e_exehist.c

index b7704a2..de2d17e 100644 (file)
@@ -450,6 +450,7 @@ _e_exehist_normalize_exe(const char *exe)
 {
    char *base, *cp, *space = NULL;
    const char *ret;
+   Eina_Bool flag = EINA_FALSE;
 
    base = basename(exe);
    if (base[0] == '.' && base[1] == '\0')
@@ -463,13 +464,23 @@ _e_exehist_normalize_exe(const char *exe)
          {
             if (!space)
               space = cp;
+            if (flag)
+              flag = EINA_FALSE;
          }
-       else
+       else if (!flag)
          {
-            char lower = tolower(*cp);
-            if (lower != *cp)
-              *cp = lower;
-            space = NULL;
+           
+            /* usually a variable in the desktop exe field */
+            if (space && *cp == '%')
+              flag = EINA_TRUE;
+            else
+              {
+                 char lower = tolower(*cp);
+                 space = NULL;
+
+                 if (lower != *cp)
+                   *cp = lower;
+              }
          }
        cp++;
      }
@@ -479,6 +490,7 @@ _e_exehist_normalize_exe(const char *exe)
 
    ret = eina_stringshare_add(base);
    free(base);
+
    return ret;
 }