deadc0de6 / dotdrop

Save your dotfiles once, deploy them everywhere
https://dotdrop.readthedocs.io
GNU General Public License v3.0
1.79k stars 105 forks source link

[feature] Ability to use either relative or absolute symlinks in `link` option #348

Closed RayZ0rr closed 2 years ago

RayZ0rr commented 2 years ago

A clear and concise description of what you want to happen.

Add new values for the link option in the config value and dotfiles sections. The possible values can be:

Why

Absolute symlinks are portable within the system. Relative symlinks are portable across different machines with different usernames.

Additional info

Possible reference links for corresponding functions:

  1. https://docs.python.org/3/library/os.path.html#os.path.commonpath
  2. https://stackoverflow.com/questions/7287996/get-relative-path-from-comparing-two-absolute-paths
  3. https://stackoverflow.com/questions/21498939/how-to-circumvent-the-fallacy-of-pythons-os-path-commonprefix
  4. https://www.geeksforgeeks.org/python-os-path-relpath-method/
deadc0de6 commented 2 years ago

Sure that's doable, I'll work on it and let you know when I have something.

deadc0de6 commented 2 years ago

This is now available on the new version (v1.9.0).

You can have a look at the doc but globally this is what you requested: absolute (absolute symlink) and relative (relative symlink).

Old link: link will be automatically updated in the config to link: absolute.

If you test the feature, please give me a feedback.