mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-01 07:41:12 +00:00
Expose cli helper for root_dir
This commit is contained in:
parent
36cfede93c
commit
5813d7ced7
1 changed files with 10 additions and 15 deletions
|
@ -234,7 +234,7 @@ pub fn extract_valgrind_errors(xml: &str) -> Result<Vec<ValgrindError>, serde_xm
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
pub fn example_dir(dir_name: &str) -> PathBuf {
|
pub fn root_dir() -> PathBuf {
|
||||||
let mut path = env::current_exe().ok().unwrap();
|
let mut path = env::current_exe().ok().unwrap();
|
||||||
|
|
||||||
// Get rid of the filename in target/debug/deps/cli_run-99c65e4e9a1fbd06
|
// Get rid of the filename in target/debug/deps/cli_run-99c65e4e9a1fbd06
|
||||||
|
@ -249,6 +249,13 @@ pub fn example_dir(dir_name: &str) -> PathBuf {
|
||||||
path.pop();
|
path.pop();
|
||||||
path.pop();
|
path.pop();
|
||||||
|
|
||||||
|
path
|
||||||
|
}
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
|
pub fn examples_dir(dir_name: &str) -> PathBuf {
|
||||||
|
let mut path = root_dir();
|
||||||
|
|
||||||
// Descend into examples/{dir_name}
|
// Descend into examples/{dir_name}
|
||||||
path.push("examples");
|
path.push("examples");
|
||||||
path.push(dir_name);
|
path.push(dir_name);
|
||||||
|
@ -258,7 +265,7 @@ pub fn example_dir(dir_name: &str) -> PathBuf {
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
pub fn example_file(dir_name: &str, file_name: &str) -> PathBuf {
|
pub fn example_file(dir_name: &str, file_name: &str) -> PathBuf {
|
||||||
let mut path = example_dir(dir_name);
|
let mut path = examples_dir(dir_name);
|
||||||
|
|
||||||
path.push(file_name);
|
path.push(file_name);
|
||||||
|
|
||||||
|
@ -267,19 +274,7 @@ pub fn example_file(dir_name: &str, file_name: &str) -> PathBuf {
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
pub fn fixtures_dir(dir_name: &str) -> PathBuf {
|
pub fn fixtures_dir(dir_name: &str) -> PathBuf {
|
||||||
let mut path = env::current_exe().ok().unwrap();
|
let mut path = root_dir();
|
||||||
|
|
||||||
// Get rid of the filename in target/debug/deps/cli_run-99c65e4e9a1fbd06
|
|
||||||
path.pop();
|
|
||||||
|
|
||||||
// If we're in deps/ get rid of deps/ in target/debug/deps/
|
|
||||||
if path.ends_with("deps") {
|
|
||||||
path.pop();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get rid of target/debug/ so we're back at the project root
|
|
||||||
path.pop();
|
|
||||||
path.pop();
|
|
||||||
|
|
||||||
// Descend into cli/tests/fixtures/{dir_name}
|
// Descend into cli/tests/fixtures/{dir_name}
|
||||||
path.push("cli");
|
path.push("cli");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue