From 538e4694d2d35c808a57937a5f3bec67b299f60f Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 12 Apr 2012 22:42:37 +0000 Subject: Fix saving state with files. git-svn-id: http://svn.drobilla.net/lad/trunk/lilv@4174 a436a847-0d15-0410-975c-d299462d15a1 --- src/state.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src/state.c') diff --git a/src/state.c b/src/state.c index 82ed8df..6441f46 100644 --- a/src/state.c +++ b/src/state.c @@ -218,22 +218,22 @@ abstract_path(LV2_State_Map_Path_Handle handle, PathMap* pm = (PathMap*)zix_tree_get(iter); free(real_path); return lilv_strdup(pm->rel); - } else if (lilv_path_is_child(absolute_path, state->dir)) { + } else if (lilv_path_is_child(real_path, state->dir)) { // File in state directory (loaded, or created by plugin during save - path = lilv_path_relative_to(absolute_path, state->dir); - } else if (lilv_path_is_child(absolute_path, state->file_dir)) { + path = lilv_path_relative_to(real_path, state->dir); + } else if (lilv_path_is_child(real_path, state->file_dir)) { // File created by plugin earlier - path = lilv_path_relative_to(absolute_path, state->file_dir); + path = lilv_path_relative_to(real_path, state->file_dir); if (state->copy_dir) { if (!lilv_path_exists(state->copy_dir, NULL)) { lilv_mkdir_p(state->copy_dir); } char* cpath = lilv_path_join(state->copy_dir, path); - char* copy = lilv_get_latest_copy(absolute_path, cpath); + char* copy = lilv_get_latest_copy(real_path, cpath); if (!copy || !lilv_file_equals(real_path, copy)) { // No recent enough copy, make a new one copy = lilv_find_free_path(cpath, lilv_path_exists, NULL); - lilv_copy_file(absolute_path, copy); + lilv_copy_file(real_path, copy); } free(real_path); free(cpath); @@ -786,8 +786,11 @@ lilv_state_write(LilvWorld* world, NULL, &subject, &p, &o, NULL, NULL); } + SerdEnv* env = serd_writer_get_env(writer); + const SerdNode* base = serd_env_get_base_uri(env, NULL); + Sratom* sratom = sratom_new(map); - sratom_set_sink(sratom, uri, + sratom_set_sink(sratom, (const char*)base->buf, (SerdStatementSink)serd_writer_write_statement, (SerdEndSink)serd_writer_end_anon, writer); -- cgit v1.2.1