Try to find a SpacetimeDB module directory, checking in order: 1. `{project_dir}/spacetimedb/` subdirectory 2. `{project_dir}` itself Returns the first path that contains a recognizable SpacetimeDB module, or `None`.
(project_dir: &Path)
| 237 | /// |
| 238 | /// Returns the first path that contains a recognizable SpacetimeDB module, or `None`. |
| 239 | pub fn find_module_path(project_dir: &Path) -> Option<PathBuf> { |
| 240 | let spacetimedb_subdir = project_dir.join("spacetimedb"); |
| 241 | if spacetimedb_subdir.is_dir() && detect_module_language(&spacetimedb_subdir).is_ok() { |
| 242 | return Some(spacetimedb_subdir); |
| 243 | } |
| 244 | if project_dir.is_dir() && detect_module_language(project_dir).is_ok() { |
| 245 | return Some(project_dir.to_path_buf()); |
| 246 | } |
| 247 | None |
| 248 | } |
| 249 | |
| 250 | pub fn detect_module_language(path_to_module: &Path) -> anyhow::Result<ModuleLanguage> { |
| 251 | // TODO: Possible add a config file durlng spacetime init with the language |
no test coverage detected
searching dependent graphs…