summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2015-02-08 05:22:10 +0000
committerDavid Robillard <d@drobilla.net>2015-02-08 05:22:10 +0000
commit765929f0b2194171c7f793dc01e227830533c420 (patch)
tree6d8fe729162338b4c5bd8aad2179759cae0e935b
parent3257b52a2ceb7d6ad36a8cd8768612ce33090003 (diff)
downloadlilv-765929f0b2194171c7f793dc01e227830533c420.tar.gz
lilv-765929f0b2194171c7f793dc01e227830533c420.tar.bz2
lilv-765929f0b2194171c7f793dc01e227830533c420.zip
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
-rw-r--r--NEWS3
-rw-r--r--lilv/lilv.h4
-rw-r--r--src/state.c9
3 files changed, 11 insertions, 5 deletions
diff --git a/NEWS b/NEWS
index a9e9756..71d3c4d 100644
--- a/NEWS
+++ b/NEWS
@@ -5,12 +5,13 @@ lilv (0.21.1) unstable;
* Expose lilv_world_load_specifications() and
lilv_world_load_plugin_classes()
* Tolerate passing NULL to lilv_state_restore()
+ * Preserve absolute paths in state if no link directory is given
* Fix a few minor/unlikely memory errors
* Configure based on compiler target OS for cross-compilation
* Windows fixes (thanks John Emmas)
* Minor documentation improvements
- -- David Robillard <d@drobilla.net> Thu, 29 Jan 2015 17:55:31 -0500
+ -- David Robillard <d@drobilla.net> Sun, 08 Feb 2015 00:21:46 -0500
lilv (0.20.0) stable;
diff --git a/lilv/lilv.h b/lilv/lilv.h
index 9d7b940..66f6d00 100644
--- a/lilv/lilv.h
+++ b/lilv/lilv.h
@@ -1263,7 +1263,9 @@ typedef const void* (*LilvGetPortValueFunc)(const char* port_symbol,
If the state will be saved, this should be the bundle directory later passed
to lilv_state_save().
- @param get_value Function to get port values.
+ @param get_value Function to get port values (or NULL). If NULL, the
+ returned state will not represent port values. This should only be NULL in
+ hosts that save and restore port values via some other mechanism.
@param user_data User data to pass to `get_value`.
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