
On 9/22/07, jiho <jo.irisson@...400...> wrote:
on OS X. If I remember well there was a document root attribute that was removed some time ago. I suspect that embbed bitmaps was looking for the images as document root+xlink and since document root is inexistant the default is used. This means that embbed images only works when sodipodi:absref is present, now that document root does not exists.
No it's not how it works. Only the XML attribute for base dir was removed, but the base dir is still part of the document in memory. It is only empty for newly created and unsaved docs (and in that situation it was empty before the attribute was removed, so nothing changed). See the algorithm in sp-image.cpp (filename is xlink:href, base is the base dir):
if (!g_path_is_absolute (filename)) { /* try to load from relative pos combined with document base*/ docbase = base; if (!docbase) docbase = "."; fullname = g_build_filename(docbase, filename, NULL);
// document base can be wrong (on the temporary doc when importing bitmap from a // different dir) or unset (when doc is not saved yet), so we check for base+href existence first, // and if it fails, we also try to use bare href regardless of its g_path_is_absolute if (g_file_test (fullname, G_FILE_TEST_EXISTS) && !g_file_test (fullname, G_FILE_TEST_IS_DIR)) { pixbuf = Inkscape::IO::pixbuf_new_from_file( fullname, NULL ); g_free (fullname); if (pixbuf != NULL) return pixbuf; } }
/* if the above failed, try filename as absolute */ if (g_file_test (filename, G_FILE_TEST_EXISTS) && !g_file_test (filename, G_FILE_TEST_IS_DIR)) { pixbuf = Inkscape::IO::pixbuf_new_from_file( filename, NULL ); if (pixbuf != NULL) return pixbuf; }
Only if all that fails, sodipodi:absref is used as a last resort, so its presence should not affect anything.
This code is pretty easy to understand, so if you can suggest any fixes or improvement to this code based on your situation (without breaking of the way it now works) it will be appreciated.