Skip to content

Commit

Permalink
chore: project root path detection feature
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelramos committed Nov 13, 2024
1 parent 7a5410c commit 9fbb4e8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 1 addition & 4 deletions crates/standard/src/paths.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use super::command::execute;

use std::{
env,
ops::Deref,
path::{Path, PathBuf},
};

Expand All @@ -28,9 +27,7 @@ pub fn get_project_root_path(root: Option<PathBuf>) -> Option<PathBuf> {
}
};

let canonic_path = &std::fs::canonicalize(Path::new(&project_root)).unwrap();

Some(canonic_path.deref().to_path_buf())
Some(PathBuf::from(project_root))
}

/// Get the git root directory.
Expand Down
4 changes: 3 additions & 1 deletion crates/standard/tests/std_paths.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ mod paths_tests {
fs::{create_dir, remove_dir_all, set_permissions, File},
io::Write,
ops::Deref,
os::unix::fs::PermissionsExt,
path::PathBuf,
};

#[cfg(not(windows))]
use std::os::unix::fs::PermissionsExt;

use ws_std::paths::get_project_root_path;

fn create_workspace() -> Result<PathBuf, std::io::Error> {
Expand Down

0 comments on commit 9fbb4e8

Please sign in to comment.