From 9817820af1f0468402934122538f658299ff71de Mon Sep 17 00:00:00 2001 From: Ogulcan Celik Date: Sat, 23 May 2026 15:11:48 +0300 Subject: feat: add worktree cli and socket api --- src/worktree.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/worktree.rs') diff --git a/src/worktree.rs b/src/worktree.rs index 058ee2b8..8c1d40bb 100644 --- a/src/worktree.rs +++ b/src/worktree.rs @@ -68,6 +68,17 @@ pub(crate) fn expand_tilde_path(path: &str) -> PathBuf { PathBuf::from(path) } +pub(crate) fn expand_tilde_absolute_path(path: &str) -> PathBuf { + let path = expand_tilde_path(path); + if path.is_absolute() { + path + } else { + std::env::current_dir() + .map(|cwd| cwd.join(&path)) + .unwrap_or(path) + } +} + pub(crate) fn canonical_or_original(path: &Path) -> PathBuf { std::fs::canonicalize(path).unwrap_or_else(|_| path.to_path_buf()) } -- cgit v1.2.3