summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBas Zalmstra <zalmstra.bas@gmail.com>2023-09-06 09:46:46 +0200
committerBas Zalmstra <zalmstra.bas@gmail.com>2023-09-06 09:46:46 +0200
commitbc2c58ca88696c3a7d02dd72974add547bd2dad3 (patch)
tree1138eb5b735e297a635adcc577fad7dbd6d96306
parent29056055a402de3d9555d5fb8d6432397cc928b2 (diff)
feat: manifest-path must point to a pixi.toml
-rw-r--r--src/project/mod.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/project/mod.rs b/src/project/mod.rs
index 9d2aa6b..7cc758a 100644
--- a/src/project/mod.rs
+++ b/src/project/mod.rs
@@ -12,11 +12,13 @@ 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},
};
+use crate::consts::PROJECT_MANIFEST;
use toml_edit::{Array, Document, Item, Table, TomlError, Value};
#[derive(Debug, Copy, Clone)]
@@ -104,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()))?;