From 765929f0b2194171c7f793dc01e227830533c420 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 8 Feb 2015 05:22:10 +0000 Subject: Preserve absolute paths in state if no link directory is given. git-svn-id: http://svn.drobilla.net/lad/trunk/lilv@5540 a436a847-0d15-0410-975c-d299462d15a1 --- src/state.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/state.c b/src/state.c index 7968493..03ad488 100644 --- a/src/state.c +++ b/src/state.c @@ -216,7 +216,7 @@ abstract_path(LV2_State_Map_Path_Handle handle, free(real_path); return lilv_strdup(pm->rel); } else if (lilv_path_is_child(real_path, state->dir)) { - // File in state directory (loaded, or created by plugin during save + // File in state directory (loaded, or created by plugin during save) 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 @@ -238,13 +238,16 @@ abstract_path(LV2_State_Map_Path_Handle handle, // Refer to the latest copy in plugin state real_path = copy; } - } else { - // New path outside state directory + } else if (state->link_dir) { + // New path outside state directory, make a link const char* slash = strrchr(real_path, '/'); const char* name = slash ? (slash + 1) : real_path; // Find a free name in the (virtual) state directory path = lilv_find_free_path(name, lilv_state_has_path, state); + } else { + // No link directory, preserve absolute path + path = lilv_strdup(abs_path); } // Add record to path mapping -- cgit v1.2.1