Enlightenment CVS committal

Author  : raster
Project : e17
Module  : apps/e

Dir     : e17/apps/e/src/bin


Modified Files:
        e_widget_fsel.c 


Log Message:


handle .order files in favorites when adding link

===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_widget_fsel.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -3 -r1.37 -r1.38
--- e_widget_fsel.c     14 Sep 2006 16:07:57 -0000      1.37
+++ e_widget_fsel.c     16 Sep 2006 12:20:31 -0000      1.38
@@ -71,27 +71,46 @@
 {
    E_Widget_Data *wd;
    const char *current_path;
-   char dest_path[PATH_MAX];
+   char buf[4096], *fname, *homedir;
    struct stat st;
    int i = 1;
+   FILE *f;
    
    wd = data1;
    current_path = e_fm2_real_path_get(wd->o_files_fm);
-   snprintf(dest_path, PATH_MAX, "%s/.e/e/fileman/favorites/%s", 
-           getenv("HOME"), basename(current_path));
-   if (stat(dest_path, &st) < 0) symlink(current_path, dest_path);
+   if (!ecore_file_is_dir(current_path)) return;
+   homedir = e_user_homedir_get();
+   if (!homedir) return;
+   snprintf(buf, sizeof(buf), "%s/.e/e/fileman/favorites/%s", 
+           homedir, ecore_file_get_file(current_path));
+   if (stat(buf, &st) < 0) symlink(current_path, buf);
    else
      {
-        while (stat(dest_path, &st) == 0)
+        while (stat(buf, &st) == 0)
          {
-            snprintf(dest_path, PATH_MAX, "%s/.e/e/fileman/favorites/%s-%d",
-                     getenv("HOME"), 
-                     basename(current_path), i);
+            snprintf(buf, sizeof(buf),
+                     "%s/.e/e/fileman/favorites/%s-%d",
+                     homedir,
+                     ecore_file_get_file(current_path), i);
             i++;
          }
-       symlink(current_path, dest_path);  
+       symlink(current_path, buf);  
      }
-   e_fm2_refresh(wd->o_favorites_fm);   
+   fname = alloca(strlen(ecore_file_get_file(buf)) + 1);
+   strcpy(fname, ecore_file_get_file(buf));
+   snprintf(buf, sizeof(buf), "%s/.e/e/fileman/favorites/.order", 
+           homedir, ecore_file_get_file(current_path));
+   if (ecore_file_exists(buf))
+     {
+       f = fopen(buf, "a");
+       if (f)
+         {
+            fprintf(f, "%s\n", fname);
+            fclose(f);
+         }
+     }
+   e_fm2_refresh(wd->o_favorites_fm);
+   free(homedir);
 }
 
 static void
@@ -599,7 +618,7 @@
 static char * 
 _e_wid_file_user_get(uid_t st_uid)
 {
-   char name[PATH_MAX];
+   char name[4096];
    struct passwd *pwd;
 
    if (getuid() == st_uid) 



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to