diff options
author | Tim de Jager <tdejager89@gmail.com> | 2023-09-07 15:42:07 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-07 15:42:07 +0200 |
commit | 92b06e57c27397a534e97546d79d1f85794e397e (patch) | |
tree | 901a68049b9355236a4b795cb7e8cac1d3d94509 | |
parent | 42a6822da818fd5a1253c35dcde89b010478a9a4 (diff) | |
parent | 3f745724b10b86761050dafb037bdd6836745357 (diff) |
Merge pull request #324 from baszalmstra/feat/manifest_path_name
feat: manifest-path must point to a pixi.toml
-rw-r--r-- | src/project/mod.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/project/mod.rs b/src/project/mod.rs index 299bdbb..95a81a8 100644 --- a/src/project/mod.rs +++ b/src/project/mod.rs @@ -2,7 +2,7 @@ pub mod environment; pub mod manifest; mod serde; -use crate::consts; +use crate::consts::{self, PROJECT_MANIFEST}; use crate::project::manifest::{ProjectManifest, TargetMetadata, TargetSelector}; use crate::task::{CmdArgs, Task}; use indexmap::IndexMap; @@ -12,6 +12,7 @@ use rattler_conda_types::{ }; use rattler_virtual_packages::VirtualPackage; use std::collections::{HashMap, HashSet}; +use std::ffi::OsStr; use std::{ env, fs, path::{Path, PathBuf}, @@ -105,6 +106,10 @@ impl Project { pub fn load(filename: &Path) -> miette::Result<Self> { // Determine the parent directory of the manifest file let full_path = dunce::canonicalize(filename).into_diagnostic()?; + if full_path.file_name().and_then(OsStr::to_str) != Some(PROJECT_MANIFEST) { + miette::bail!("the manifest-path must point to a {PROJECT_MANIFEST} file"); + } + let root = full_path .parent() .ok_or_else(|| miette::miette!("can not find parent of {}", filename.display()))?; |