Enlightenment CVS committal

Author  : lordchaos
Project : e17
Module  : apps/evfs

Dir     : e17/apps/evfs/src/bin


Modified Files:
        evfs_server_handle.c 


Log Message:
* Cleanups
* Recursive file delete (be careful!)
* Sort results of directory lists

===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/evfs/src/bin/evfs_server_handle.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -3 -r1.25 -r1.26
--- evfs_server_handle.c        20 Dec 2005 21:55:02 -0000      1.25
+++ evfs_server_handle.c        27 Dec 2005 11:44:35 -0000      1.26
@@ -101,12 +101,52 @@
 }
 
 void evfs_handle_file_remove_command(evfs_client* client, evfs_command* 
command) {
+       struct stat file_stat;
+       
        printf("At remove handle\n");
 
        evfs_plugin* plugin = evfs_get_plugin_for_uri(client->server, 
command->file_command.files[0]->plugin_uri);
        if (plugin) {
+               (*plugin->functions->evfs_file_stat)(command, &file_stat);
+               
                printf("Pointer here: %p\n", 
plugin->functions->evfs_file_remove);
-               
(*plugin->functions->evfs_file_remove)(command->file_command.files[0]->path);
+
+               /*If we're not a dir, simple remove command*/
+               if (!S_ISDIR(file_stat.st_mode)) { 
+                       
+                       
(*plugin->functions->evfs_file_remove)(command->file_command.files[0]->path);
+                       //
+                       printf("REMOVE FIL: '%s'\n", 
command->file_command.files[0]->path);
+
+               } else {
+                       /*It's a directory, recurse into it*/
+                       Ecore_List* directory_list = NULL;
+                       evfs_filereference* file = NULL;
+                       
+                       /*First, we need a directory list...*/
+                       
(*plugin->functions->evfs_dir_list)(client,command,&directory_list);
+                       if (directory_list) {
+                               while ((file = 
ecore_list_remove_first(directory_list))) {
+                                       evfs_command* recursive_command = 
NEW(evfs_command);
+
+                                       recursive_command->file_command.files = 
malloc(sizeof(evfs_filereference*)*1);
+                                       recursive_command->type = 
EVFS_CMD_REMOVE_FILE;
+                                       
recursive_command->file_command.files[0] = file;
+                                       
recursive_command->file_command.num_files = 1;
+
+                                       evfs_handle_file_remove_command(client, 
recursive_command);
+
+
+                                       
evfs_cleanup_command(recursive_command,1);
+                                       
+                               }
+                       }
+
+                       printf("REMOVE DIR: '%s'\n", 
command->file_command.files[0]->path);
+                       
(*plugin->functions->evfs_file_remove)(command->file_command.files[0]->path);
+
+
+               }
        }
 }
 
@@ -214,7 +254,6 @@
        struct stat file_stat;
        int progress = 0;
        int last_notify_progress = 0;
-       evfs_filereference* ref = NEW(evfs_filereference);
 
        plugin = evfs_get_plugin_for_uri(client->server, 
command->file_command.files[0]->plugin_uri);
        dst_plugin = evfs_get_plugin_for_uri(client->server, 
command->file_command.files[1]->plugin_uri);
@@ -265,6 +304,7 @@
                        
(*plugin->functions->evfs_dir_list)(client,command,&directory_list);
                        if (directory_list) {
                                int ret =0;
+                               evfs_filereference* file = NULL;
                                                
                                /*OK, so the directory exists at the source, 
and contains files.
                                 * Let's make the destination directory 
first..*/
@@ -272,7 +312,7 @@
                                ret=  
(*dst_plugin->functions->evfs_file_mkdir)(command->file_command.files[1]);
                                printf("....ret was %d\n", ret);
                                
-                               evfs_filereference* file = NULL;
+                               
                                //printf("Recursive directory list for '%s' 
received..\n", command->file_command.files[0]->path);
                                while ((file = 
ecore_list_remove_first(directory_list))) {
                                        evfs_filereference* source = 
NEW(evfs_filereference);




-------------------------------------------------------
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