git_same/commands/support/
workspace.rs1use crate::config::WorkspaceConfig;
2use crate::errors::{AppError, Result};
3use crate::output::Output;
4
5pub(crate) fn ensure_base_path(workspace: &WorkspaceConfig, output: &Output) -> Result<()> {
10 let base_path = workspace.expanded_base_path();
11 if base_path.is_dir() {
12 return Ok(());
13 }
14 if base_path.exists() {
15 return Err(AppError::config(format!(
16 "Base path '{}' exists but is not a directory.",
17 base_path.display()
18 )));
19 }
20
21 output.warn(&format!(
22 "Base path '{}' does not exist. Run 'gisa setup' to reconfigure.",
23 base_path.display()
24 ));
25 Err(AppError::config(format!(
26 "Base path '{}' does not exist.",
27 base_path.display()
28 )))
29}
30
31#[cfg(test)]
32#[path = "workspace_tests.rs"]
33mod tests;