summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-12-18 17:26:36 +0100
committerDavid Robillard <d@drobilla.net>2020-12-18 17:39:13 +0100
commite9bce3d4b0cf4cb95c6e3aaa7fe571be1151cd74 (patch)
tree209305ae3d3b7c255a926d0a223473094f78a0d6
parenta3f425d6d2f70d31f614187453e47252bce9fc7e (diff)
downloadlilv-e9bce3d4b0cf4cb95c6e3aaa7fe571be1151cd74.tar.gz
lilv-e9bce3d4b0cf4cb95c6e3aaa7fe571be1151cd74.tar.bz2
lilv-e9bce3d4b0cf4cb95c6e3aaa7fe571be1151cd74.zip
Make symlink targets relative when they share a common parent
This might not be the right thing in every case, but it's the best we can do without API to specifically configure this sort of thing (like setting a project root) which doesn't currently exist.
-rw-r--r--src/filesystem.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/filesystem.c b/src/filesystem.c
index bed9f81..b674113 100644
--- a/src/filesystem.c
+++ b/src/filesystem.c
@@ -351,7 +351,11 @@ lilv_symlink(const char* oldpath, const char* newpath)
#ifdef _WIN32
ret = !CreateHardLink(newpath, oldpath, 0);
#else
- ret = symlink(oldpath, newpath);
+ char* target = lilv_path_relative_to(oldpath, newpath);
+
+ ret = symlink(target, newpath);
+
+ free(target);
#endif
}
return ret;