Enlightenment CVS committal Author : raster Project : e17 Module : libs/evas
Dir : e17/libs/evas/src/modules/loaders/svg Modified Files: evas_image_load_svg.c Log Message: change cwd to the dir with the svg - if the svg has relative paths to bitmap files included in the svg =================================================================== RCS file: /cvs/e/e17/libs/evas/src/modules/loaders/svg/evas_image_load_svg.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- evas_image_load_svg.c 17 Aug 2006 14:11:59 -0000 1.1 +++ evas_image_load_svg.c 17 Aug 2006 23:43:17 -0000 1.2 @@ -40,22 +40,33 @@ evas_image_load_file_head_svg(RGBA_Image *im, const char *file, const char *key) { DATA32 *ptr, *end; - FILE *f; + char cwd[PATH_MAX], pcwd[PATH_MAX], *p; RsvgHandle *rsvg; RsvgDimensionData dim; if (!file) return 0; + getcwd(pcwd, sizeof(pcwd)); + strncpy(cwd, file, sizeof(cwd) - 1); + cwd[sizeof(cwd) - 1] = 0; + p = strrchr(cwd, '/'); + if (p) *p = 0; + chdir(cwd); + rsvg = rsvg_handle_new_from_file(file, NULL); if (!rsvg) - return 0; + { + chdir(pcwd); + return 0; + } if (!im->image) { im->image = evas_common_image_surface_new(im); if (!im->image) { rsvg_handle_free(rsvg); + chdir(pcwd); return 0; } } @@ -66,6 +77,7 @@ im->image->h = dim.height; im->flags |= RGBA_IMAGE_HAS_ALPHA; rsvg_handle_free(rsvg); + chdir(pcwd); return 1; } @@ -74,7 +86,7 @@ evas_image_load_file_data_svg(RGBA_Image *im, const char *file, const char *key) { DATA32 *ptr, *end; - FILE *f; + char cwd[PATH_MAX], pcwd[PATH_MAX], *p; RsvgHandle *rsvg; RsvgDimensionData dim; @@ -86,11 +98,19 @@ if (!file) return 0; if (!im->image) return 0; + getcwd(pcwd, sizeof(pcwd)); + strncpy(cwd, file, sizeof(cwd) - 1); + cwd[sizeof(cwd) - 1] = 0; + p = strrchr(cwd, '/'); + if (p) *p = 0; + chdir(cwd); + rsvg = rsvg_handle_new_from_file(file, NULL); if (!rsvg) { evas_common_image_surface_free(im->image); im->image = NULL; + chdir(pcwd); return 0; } @@ -107,6 +127,7 @@ evas_common_image_surface_free(im->image); im->image = NULL; rsvg_handle_free(rsvg); + chdir(pcwd); return 0; } @@ -117,6 +138,7 @@ evas_common_image_surface_free(im->image); im->image = NULL; rsvg_handle_free(rsvg); + chdir(pcwd); return 0; } cr = cairo_create(surface); @@ -126,6 +148,7 @@ evas_common_image_surface_free(im->image); im->image = NULL; rsvg_handle_free(rsvg); + chdir(pcwd); return 0; } @@ -136,6 +159,7 @@ rsvg_handle_free(rsvg); /* un-premul the im data */ svg_loader_unpremul_data(im->image->data, w * h); + chdir(pcwd); return 1; } ------------------------------------------------------------------------- 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