Enlightenment CVS committal Author : lordchaos Project : e17 Module : proto
Dir : e17/proto/entropy/src Modified Files: entropy_core.c Log Message: * Move the uri generation function to the core. This function still needs to be made generically recursible =================================================================== RCS file: /cvsroot/enlightenment/e17/proto/entropy/src/entropy_core.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -3 -r1.16 -r1.17 --- entropy_core.c 9 Nov 2005 09:57:41 -0000 1.16 +++ entropy_core.c 9 Nov 2005 11:27:35 -0000 1.17 @@ -21,6 +21,7 @@ static int requests = 0; static long file_cache_size = 0; +entropy_core* core_core; #define FILE_FREE_QUEUE_SIZE 500; @@ -117,6 +118,7 @@ entropy_core* core = entropy_core_new(); + core_core=core; /*Init the file cache mutex*/ pthread_mutex_init(&core->file_cache_mutex, NULL); @@ -1005,6 +1007,61 @@ } +char* entropy_core_generic_file_uri_create (entropy_generic_file* file, int drill_down) { + entropy_generic_file* source_file; + char* uri = malloc(PATH_MAX); + char* uri_retrieve; + char uri_build[255]; + + /*If the file/location we are requesting has a 'parent' (i.e. it's inside another object), + * we have to grab the parent, not the file itself, as the base*/ + if (file->parent) { + source_file = file->parent; + } else + source_file = file; + + + /*Do we have login information*/ + /*TODO - wrap this up in some kind of entropy_generic_file_to_evfs_uri function*/ + if (!source_file->username) { + snprintf(uri, 512, "%s://%s/%s", source_file->uri_base, source_file->path, source_file->filename); + } else { + snprintf(uri, 512, "%s://%s:[EMAIL PROTECTED]/%s", source_file->uri_base, + source_file->username, source_file->password, + source_file->path, source_file->filename); + } + + + printf("EVFS says that this file descends through '%s'\n", uri); + + if (drill_down || file->parent) { + /*If we're a 'drill-down', we're at the root - so request the root*/ + if (drill_down) { + uri_retrieve = entropy_core_descent_for_mime_get(core_core,file->mime_type); + snprintf(uri_build, 255, "#%s:///", uri_retrieve); + printf("URI build says: '%s'\n", uri_build); + strcat(uri, uri_build); + } else if (file->parent) { + printf("Retrieving mime-descend from parent...'%s' for file with name '%s'\n", + file->parent->mime_type, file->parent->filename); + + uri_retrieve = entropy_core_descent_for_mime_get(core_core,file->parent->mime_type); + + /*Special case handler for the root dir - FIXME*/ + printf("Path: '%s', filename '%s'\n", file->path, file->filename); + if (!strcmp(file->path,"/")) { + snprintf(uri_build, 255, "#%s://%s%s", uri_retrieve, file->path, file->filename); + } else { + snprintf(uri_build, 255, "#%s://%s/%s", uri_retrieve, file->path, file->filename); + } + strcat(uri, uri_build); + } + } + + return uri; +} + + void* entropy_malloc(size_t size) { requests++; ------------------------------------------------------- SF.Net email is sponsored by: Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42" plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs