diff options
| author | Max Bossing <max@bossi.ng> | 2025-07-19 17:00:42 +0200 |
|---|---|---|
| committer | Max Bossing <max@bossi.ng> | 2025-07-19 17:00:42 +0200 |
| commit | be07419e395cdb27607ceaa67b76a7ba25972d96 (patch) | |
| tree | a0223ae6ebc2ee30bb0a4abc24bc10a8b944726e | |
| parent | 15bcc6147fff93a8862ada7d564bd558bba5c6e4 (diff) | |
feat: respect absolute/relative paths in dest field
| -rw-r--r-- | Cargo.lock | 2 | ||||
| -rw-r--r-- | Cargo.toml | 2 | ||||
| -rw-r--r-- | README.md | 8 | ||||
| -rw-r--r-- | src/dots.rs | 4 |
4 files changed, 8 insertions, 8 deletions
@@ -133,7 +133,7 @@ dependencies = [ [[package]] name = "dots" -version = "2.0.0" +version = "2.1.0" dependencies = [ "clap", "dirs", @@ -1,7 +1,7 @@ [package] name = "dots" description = "System-agnostic dotfile-deployer " -version = "2.0.0" +version = "2.1.0" edition = "2024" [dependencies] @@ -33,11 +33,11 @@ dots_dir = "/home/anon/dots" # If omitted, defaults to working directory [[dot]] src = "nvim" # Resolved against dots_dir -dest = ".config/nvim" # Resolved against $HOME +dest = ".config/nvim" # Relative paths are resolved against $HOME [[dot]] -src = "fish" -dest = ".config/fish" +src = "Xmodmap" +dest = "/etc/X11" # Absolute paths are respected [[dot]] src = "tmux.conf" @@ -53,7 +53,7 @@ dots deploy --config some_file.dots.toml ## Todo - [x] Allow to "undeploy", eg. to automatically remove symlinks created by `dots` -- [ ] Absolute Paths in dest field +- [x] Absolute Paths in dest field ## License This is licensed under the [MIT](LICENSE) license. diff --git a/src/dots.rs b/src/dots.rs index 5b75254..0259c0c 100644 --- a/src/dots.rs +++ b/src/dots.rs @@ -8,7 +8,7 @@ pub fn deploy_dots(dots: Vec<Dot>, dots_dir: PathBuf) { let prepended_dots = dots.iter().map(|m| Dot { source: dots_dir.join(&m.source), - destination: prepend_user_dir(&m.destination) + destination: if m.destination.is_absolute() { m.destination.clone() } else { prepend_user_dir(&m.destination) } } ); @@ -45,4 +45,4 @@ pub fn unlink_dots(dots: Vec<Dot>, dots_dir: PathBuf) { fn prepend_user_dir(path: &PathBuf) -> PathBuf { home_dir().unwrap().join(path) -}
\ No newline at end of file +} |
