refactor(rust): align workspace with style rules
This commit is contained in:
20
src/monorepo/workspace.rs
Normal file
20
src/monorepo/workspace.rs
Normal file
@@ -0,0 +1,20 @@
|
||||
use std::path::PathBuf;
|
||||
|
||||
pub fn resolve_workspace_path(path: PathBuf) -> PathBuf {
|
||||
resolve_workspace_path_impl(
|
||||
path,
|
||||
std::env::var_os("BUILD_WORKSPACE_DIRECTORY").map(PathBuf::from),
|
||||
)
|
||||
}
|
||||
|
||||
fn resolve_workspace_path_impl(path: PathBuf, workspace: Option<PathBuf>) -> PathBuf {
|
||||
if path.is_absolute() {
|
||||
return path;
|
||||
}
|
||||
|
||||
if let Some(workspace) = workspace {
|
||||
return workspace.join(path);
|
||||
}
|
||||
|
||||
path
|
||||
}
|
||||
Reference in New Issue
Block a user