Skip to content

Commit 686cc18

Browse files
committed
fix: use strip_prefix instead of manual slicing
1 parent 89b7aa2 commit 686cc18

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/cortex-cli/src/utils/paths.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ pub fn expand_tilde(path: &str) -> String {
3939
if let Some(home) = dirs::home_dir() {
4040
return home.to_string_lossy().to_string();
4141
}
42-
} else if path.starts_with("~/") {
42+
} else if let Some(suffix) = path.strip_prefix("~/") {
4343
// Handle "~/" prefix - expand to home directory + rest of path
4444
if let Some(home) = dirs::home_dir() {
45-
return home.join(&path[2..]).to_string_lossy().to_string();
45+
return home.join(suffix).to_string_lossy().to_string();
4646
}
4747
}
4848
path.to_string()

0 commit comments

Comments
 (0)