diff options
-rw-r--r-- | src/state.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/state.c b/src/state.c index 57a5783..97709d3 100644 --- a/src/state.c +++ b/src/state.c @@ -307,11 +307,12 @@ abstract_path(LV2_State_Map_Path_Handle handle, } } 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; + char* const name = lilv_path_filename(real_path); // Find a free name in the (virtual) state directory path = lilv_find_free_path(name, lilv_state_has_path, state); + + free(name); } else { // No link directory, preserve absolute path path = lilv_strdup(abs_path); |