Platform specific link paths
See original GitHub issueHello, I’ve been using dotbot to manage my dotfiles for some time now. It has worked great thus far, since most applications read from a common configuration directory on all platforms. Sublime Text however, uses different directories depending on what platform you’re on.
Would it be feasible to add support for different destination paths depending on your OS?
In Python there’s sys.platform
which contains a string representing the platform Python is running on.
As for configuration syntax, I’m not sure. YAML has a construct where you can map keys to values, see example 2.6, but since dotbot maps links “the other way”, the syntax wouldn’t make sense (and is syntactically incorrect):
- link:
{
linux: ~/.config/sublime-text-3,
darwin: ~/Library/Application Support/Sublime Text 3,
win32: ~/Sublime Text 3
}: Sublime Text 3/
If you flip the target and destination, I think it looks decent and you would still be able to configure links independently of the OS/platform. It would obviously break all existing configuration files, however.
- link:
Sublime Text 3/:
linux: ~/.config/sublime-text-3,
darwin: ~/Library/Application Support/Sublime Text 3,
win32: ~/Sublime Text 3
vim/: ~/.vim
What do you think?
Issue Analytics
- State:
- Created 8 years ago
- Reactions:4
- Comments:13 (7 by maintainers)
Top GitHub Comments
Apparently this can also be solved with the shell conditions feature (https://github.com/anishathalye/dotbot/issues/143):
For your example @sjthespian
Does that sound right?
I’ll throw in another vote for this feature with a slight twist. It would be nice to not only be able to have os-specific links, but also install config files for some applications only on the systems that support them, for example only installing my hammerspoon config if I’m on a Mac.
I think the config example above is along the lines of what I am thinking. If a platform isn’t listed, the link won’t be created on that platform and you would need a way to specify a default in some cases. for example: