Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions dttools/src/file_link_recursive.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,18 @@ int file_link_recursive(const char *source, const char *target, int allow_symlin
be accidentally relative to the current directory.
*/

char *cwd = path_getcwd();
char *absolute_source = string_format("%s/%s", cwd, source);

int result = symlink(absolute_source, target);

free(absolute_source);
free(cwd);
int result = 0;
if (source[0] == '/') {
result = symlink(source, target);
} else {
char *cwd = path_getcwd();
char *absolute_source = string_format("%s/%s", cwd, source);

result = symlink(absolute_source, target);

free(absolute_source);
free(cwd);
}

if (result == 0)
return 1;
Expand Down