Enlightenment CVS committal Author : chaos Project : e17 Module : apps/evfs
Dir : e17/apps/evfs/src/plugins/file Modified Files: evfs_fs_posix.c evfs_fs_trash.c Log Message: * Implement a 'stat' proxy for the trash_fs =================================================================== RCS file: /cvs/e/e17/apps/evfs/src/plugins/file/evfs_fs_posix.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- evfs_fs_posix.c 14 Aug 2006 11:07:48 -0000 1.2 +++ evfs_fs_posix.c 15 Aug 2006 12:04:32 -0000 1.3 @@ -393,7 +393,6 @@ { int res; - //printf("Getting file stat...\n"); #ifdef __USE_LARGEFILE64 res = stat64(command->file_command.files[file_number]->path, file_stat); #else =================================================================== RCS file: /cvs/e/e17/apps/evfs/src/plugins/file/evfs_fs_trash.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- evfs_fs_trash.c 15 Aug 2006 08:22:56 -0000 1.3 +++ evfs_fs_trash.c 15 Aug 2006 12:04:32 -0000 1.4 @@ -75,6 +75,25 @@ Ecore_List ** directory_list); +evfs_filereference* evfs_fs_trash_proxy_create(evfs_filereference* ref, char* newpath) +{ + int size; + evfs_filereference* newfile = evfs_filereference_clone(ref); + + /*Make a proxy file, and send this to the posix plugin create*/ + free(newfile->path); + + size= strlen(evfs_fs_trash_files) + strlen(newpath) +2; + newfile->path = calloc(size, 1); + snprintf(newfile->path, size, "%s/%s", evfs_fs_trash_files, newpath); + free(newfile->plugin_uri); + + newfile->plugin_uri = strdup("file"); + newfile->plugin = posix_plugin; + + return newfile; +} + /*Internal functions*/ char* evfs_fs_trash_filename_get(evfs_filereference* ref) { @@ -105,7 +124,7 @@ /* 1 for '/', 1 for \0 */ origlen = strlen(evfs_fs_trash_info) + 1 + strlen(newname)+10+1; fullpath = malloc(origlen); - snprintf(fullpath, origlen, "%s/%s", evfs_fs_trash_info, newname, ".trashinfo"); + snprintf(fullpath, origlen, "%s/%s%s", evfs_fs_trash_info, newname, ".trashinfo"); printf("Create info file: '%s'\n", fullpath); @@ -175,10 +194,45 @@ int evfs_file_stat(evfs_command * command, struct stat *file_stat, int file_number) { + evfs_filereference* ref = command->file_command.files[file_number]; + /*FIXME - if we're asking for the root - it's a directory*/ - if (!strcmp(command->file_command.files[file_number]->path, "/")) { + if (!strcmp(ref->path, "/")) { file_stat->st_mode |= S_IFDIR; return EVFS_SUCCESS; + } else { + if (ref->attach) { + evfs_filereference* proxy; + char* pos; + char* slashpos; + + pos = strstr(ref->attach, ".trashinfo"); + slashpos = strrchr(ref->attach, '/'); + if (pos && slashpos) { + char* newfile = NULL; + evfs_command* command_proxy; + int res; + int newsize; + + newsize= strlen(slashpos) - strlen(".trashinfo"); + newfile = malloc(newsize); + strncpy(newfile, slashpos+1 , newsize); + newfile[newsize-1] = '\0'; + proxy = evfs_fs_trash_proxy_create(ref, newfile); + free(newfile); + + command_proxy = evfs_file_command_single_build(proxy); + + res = (*EVFS_PLUGIN_FILE(proxy->plugin)->functions->evfs_file_stat) + (command_proxy, file_stat, 0); + + evfs_cleanup_command(command_proxy,EVFS_CLEANUP_FREE_COMMAND); + + return res; + } else { + printf("Attach data did not contain trashinfo\n"); + } + } } return EVFS_ERROR; @@ -240,20 +294,13 @@ int evfs_file_create(evfs_filereference * file) { - evfs_filereference* file_trash = evfs_filereference_clone(file); + evfs_filereference* file_trash; int fd; - int size; - /*Make a proxy file, and send this to the posix plugin create*/ - free(file_trash->path); - size= strlen(evfs_fs_trash_files) + strlen(next_trash_file) +2; - file_trash->path = calloc(size, 1); - snprintf(file_trash->path, size, "%s/%s", evfs_fs_trash_files, next_trash_file); - free(file_trash->plugin_uri); - file_trash->plugin_uri = strdup("file"); - file_trash->plugin = posix_plugin; - printf("Creating new file: %s\n", file_trash->path); + file_trash = evfs_fs_trash_proxy_create(file, next_trash_file); + + /*printf("Creating new file: %s\n", file_trash->path);*/ /*Dispatch to posix*/ (*EVFS_PLUGIN_FILE(file_trash->plugin)->functions->evfs_file_create) (file_trash); ------------------------------------------------------------------------- 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