Using glib facilities, you can do this (assumes filename has been g_malloc()ed):
if (!g_path_is_absolute(filename)) { gchar *abs_filename, *current_dir;
current_dir = g_get_current_dir(); abs_filename = g_build_filename(current_dir, filename, NULL);
g_free(current_dir); g_free(filename); filename = abs_filename; }
Unfortunately this is not smart enough. If I open "../filename.svg", the resulting "absolute" pathname will have ".." in the middle. Which is why I was asking if there exists a smart absolute path function that normalizes paths. Or can't the OS return the absolute path of a given file?
_________________________________________________________________ The new MSN 8: smart spam protection and 2 months FREE* http://join.msn.com/?page=features/junkmail http://join.msn.com/?page=dept/bcomm&pgmarket=en-ca&RU=http%3a%2f%2f...