diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-05-23 15:11:48 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-05-23 15:19:36 +0300 |
| commit | 9817820af1f0468402934122538f658299ff71de (patch) | |
| tree | 1bf668cf866213d10eec30a85401aedc54fb714f /src/worktree.rs | |
| parent | ed11779fcaebea7cc3223c4e221ea43674057891 (diff) | |
feat: add worktree cli and socket api
Diffstat (limited to 'src/worktree.rs')
| -rw-r--r-- | src/worktree.rs | 11 |
1 files changed, 11 insertions, 0 deletions
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()) } |
