diff options
| author | Lotte Steenbrink <lotte.steenbrink@ferrous-systems.com> | 2021-09-17 15:44:33 +0200 |
|---|---|---|
| committer | Lotte Steenbrink <lotte.steenbrink@ferrous-systems.com> | 2021-09-20 18:46:15 +0200 |
| commit | 7ce4391e4e6bce03d42962266fe0587922e13571 (patch) | |
| tree | a129a1af92a03b75b4ecc52cb35a776af16ff0c7 /xtask/src/main.rs | |
| parent | d172df6f0a9e105fbb501dc2c044ab685a269246 (diff) | |
improve xtask repo root check to not break our fork CI#
Diffstat (limited to 'xtask/src/main.rs')
| -rw-r--r-- | xtask/src/main.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/xtask/src/main.rs b/xtask/src/main.rs index c1d4905..4d582dd 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -4,7 +4,6 @@ mod command; use anyhow::bail; use core::fmt; use std::{ - env, error::Error, ffi::OsString, path::{Path, PathBuf}, @@ -68,8 +67,10 @@ impl fmt::Display for TestRunError { impl Error for TestRunError {} fn main() -> anyhow::Result<()> { - let execution_dir = env::current_dir()?; - if execution_dir.file_name().unwrap() != "cortex-m-rtic" { + // if there's an `xtask` folder, we're *probably* at the root of this repo (we can't just + // check the name of `env::current_dir()` because people might clone it into a different name) + let probably_running_from_repo_root = Path::new("./xtask").exists(); + if probably_running_from_repo_root == false { bail!("xtasks can only be executed from the root of the `cortex-m-rtic` repository"); } |
