Skip to content

Draft: Relative symlinks

Problem

  • Let's say the current working dir is /home/abc. Now there is a file Solution.java in /home/abc .
  • Now I create a symlink sol.java using ln -s Solution.java sol.java .
  • Since I am not creating the symlink with absolute path, when thunar calls for this symlink target it only gets Solution.java instead of /home/abc/Solution.java . So this path is now being regarded as a relative path.
  • So if a g_file_new_for_path is called using this path then the return value would be /path/from/where/thunar/started/Solution.java in this case.

Solution

Check validity of the generated target from g_file_info_get_symlink_target and if wrong then generate the target path using the symlink-files parent path. If this relative symlink path is wrong (Also set this relative path as symlink_target_path if file exists/correct ?) then return NULL.

Related MR: !227 (merged)

As suggested by @MShrimp4 in the MR !227 (merged), I have opened this new MR since this is a general problem and distinguishable from the issue (#71 (closed)) MR !227 (merged) is solving.

Merge request reports