From e9bce3d4b0cf4cb95c6e3aaa7fe571be1151cd74 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 18 Dec 2020 17:26:36 +0100 Subject: 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. --- src/filesystem.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/filesystem.c') 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; -- cgit v1.2.1