Enlightenment CVS committal

Author  : devilhorns
Project : e_modules
Module  : screenshot

Dir     : e_modules/screenshot


Modified Files:
        e_mod_main.c 


Log Message:
Better trapping for config->filename. Strip the extension in case the user adds 
it.
===================================================================
RCS file: /cvsroot/enlightenment/e_modules/screenshot/e_mod_main.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -3 -r1.25 -r1.26
--- e_mod_main.c        20 Feb 2006 18:27:16 -0000      1.25
+++ e_mod_main.c        26 Feb 2006 19:17:18 -0000      1.26
@@ -187,7 +187,7 @@
 # endif
 #endif
         e->conf->location = (char *)evas_stringshare_add(e_user_homedir_get());
-        e->conf->filename = (char *)evas_stringshare_add("");
+        e->conf->filename = (char *)evas_stringshare_add("screenshot%d");
 #ifdef HAVE_IMPORT
         e->conf->import.use_img_border = 1;
         e->conf->import.use_dither = 1;
@@ -583,7 +583,8 @@
    Ecore_List *fl = NULL;
    int c = 0;
    char *file, *x;
-
+   char *tmp;
+   
    /* Get Location */
    if (!conf->location)
      {
@@ -626,26 +627,26 @@
                        c++;
                     }
                   /* Add To Filename */
-                  snprintf(buff, sizeof(buff), strdup(conf->filename), c);
+                 /* Strip extension in case user adds it */
+                 tmp = ecore_file_strip_ext(conf->filename);             
+                  snprintf(buff, sizeof(buff), strdup(tmp), c);
                   snprintf(buff, sizeof(buff), "%s/%s.png",
                            strdup(conf->location), strdup(buff));
                }
           }
         else
           {
-             snprintf(buff, sizeof(buff), strdup(conf->filename));
+            /* Strip extension in case user adds it */
+            tmp = ecore_file_strip_ext(conf->filename);             
+             snprintf(buff, sizeof(buff), strdup(tmp));
              snprintf(buff, sizeof(buff), "%s/%s.png", strdup(conf->location),
                       strdup(buff));
           }
      }
    if (buff)
-     {
-        return strdup(buff);
-     }
+     return strdup(buff);
    else
-     {
-        return NULL;
-     }
+     return NULL;
 }
 
 static int




-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to