Enlightenment CVS committal Author : chaos Project : e17 Module : apps/evfs
Dir : e17/apps/evfs/src/lib Modified Files: evfs_commands.c libevfs.c Log Message: * File copy function now handles multiple files, as long as the dest file is a directory =================================================================== RCS file: /cvs/e/e17/apps/evfs/src/lib/evfs_commands.c,v retrieving revision 1.32 retrieving revision 1.33 diff -u -3 -r1.32 -r1.33 --- evfs_commands.c 20 Jul 2006 17:49:51 -0000 1.32 +++ evfs_commands.c 6 Aug 2006 09:56:27 -0000 1.33 @@ -141,6 +141,44 @@ return id; } +long +evfs_client_file_copy_multi(evfs_connection * conn, Ecore_List* files, + evfs_filereference* to) +{ + evfs_command *command = evfs_client_command_new(); + long id = command->client_identifier; + long count = 0; + long cfile = 0; + evfs_filereference* ref; + char* str; + + count = ecore_list_nodes(files); + + command->type = EVFS_CMD_FILE_COPY; + command->file_command.num_files = count+1; + command->file_command.files = malloc(sizeof(evfs_filereference *) * (count+1)); + + printf("Sending %d files for multi copy...\n", count+1); + ecore_list_goto_first(files); + while ((ref = ecore_list_next(files))) { + command->file_command.files[cfile] = ref; + cfile++; + + str = evfs_filereference_to_string(ref); + printf("Added %s to multi copy\n", str); + free(str); + } + command->file_command.files[cfile] = to; + + evfs_write_command(conn, command); + + free(command->file_command.files); + free(command); + + return id; + +} + long evfs_client_file_move(evfs_connection * conn, evfs_filereference * from, evfs_filereference * to) =================================================================== RCS file: /cvs/e/e17/apps/evfs/src/lib/libevfs.c,v retrieving revision 1.45 retrieving revision 1.46 diff -u -3 -r1.45 -r1.46 --- libevfs.c 22 Jul 2006 13:12:58 -0000 1.45 +++ libevfs.c 6 Aug 2006 09:56:27 -0000 1.46 @@ -432,10 +432,28 @@ ecore_dlist_destroy(tokens); } + +evfs_file_uri_path* +evfs_parse_uri(char* uri) +{ + evfs_file_uri_path* path = NEW(evfs_file_uri_path); + evfs_filereference* ref; + + ref = evfs_parse_uri_single(uri); + if (ref) { + path->files = calloc(1, sizeof(evfs_filereference*)); + path->files[0] = ref; + path->num_files = 1; + } + + return path; + +} + /*Function to parse a uri*/ /*We should rewrite this,use a proper parser*/ -evfs_file_uri_path * -evfs_parse_uri(char *uri) +evfs_filereference * +evfs_parse_uri_single(char *uri) { char *pos; char *tok; @@ -443,7 +461,6 @@ int i; evfs_filereference *ref = NULL, *new_ref = NULL, *root_ref = NULL, *bottom_ref = NULL; - evfs_file_uri_path *path = NEW(evfs_file_uri_path); Ecore_DList *tokens; /*for (i=0;i<strlen(uri);i++) { @@ -486,6 +503,7 @@ { printf("Couldn't get a plugin uri, token was (instead): '%s'\n", token->token_s); + return NULL; } token = evfs_token_expect(tokens, EVFS_URI_TOKEN_OPERATOR, "://"); /* '://' */ @@ -502,7 +520,7 @@ new_ref->username = strdup(token->token_s); } - token = evfs_token_expect(tokens, EVFS_URI_TOKEN_OPERATOR, ":"); /* ':' */ + if (!(token = evfs_token_expect(tokens, EVFS_URI_TOKEN_OPERATOR, ":"))) return NULL; /* ':' */ token = evfs_token_expect(tokens, EVFS_URI_TOKEN_STRING, NULL); if (token) @@ -511,9 +529,8 @@ new_ref->password = strdup(token->token_s); } - token = evfs_token_expect(tokens, EVFS_URI_TOKEN_OPERATOR, "@"); /* '@' */ - - token = evfs_token_expect(tokens, EVFS_URI_TOKEN_OPERATOR, "/"); /* '/' */ + if (!(token = evfs_token_expect(tokens, EVFS_URI_TOKEN_OPERATOR, "@"))) return NULL; /* '@' */ + if (!(token = evfs_token_expect(tokens, EVFS_URI_TOKEN_OPERATOR, "/"))) return NULL; /* '/' */ } if (token) @@ -552,13 +569,9 @@ root_ref = new_ref; bottom_ref = new_ref; - path->files = malloc(sizeof(evfs_filereference *)); - path->num_files = 1; - path->files[0] = bottom_ref; - evfs_token_list_free(tokens); - return path; + return bottom_ref; } char * ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs