Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(starknet_api): revert use get_packaget_dir instead of env var #2449

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions crates/starknet_api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ testing = []

[dependencies]
bitvec.workspace = true
cairo-lang-runner.workspace = true
cairo-lang-starknet-classes.workspace = true
cairo-lang-runner.workspace = true
derive_more.workspace = true
hex.workspace = true
indexmap = { workspace = true, features = ["serde"] }
infra_utils.workspace = true
itertools.workspace = true
num-bigint.workspace = true
papyrus_proc_macros.workspace = true
pretty_assertions.workspace = true
primitive-types = { workspace = true, features = ["serde"] }
semver.workspace = true
Expand All @@ -35,5 +35,8 @@ thiserror.workspace = true
assert_matches.workspace = true
rstest.workspace = true

[package.metadata.cargo-machete]
ignored = ["strum"]

[lints]
workspace = true
12 changes: 5 additions & 7 deletions crates/starknet_api/src/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::collections::HashMap;
use std::fs::read_to_string;
use std::path::{Path, PathBuf};

use papyrus_proc_macros::generate_get_package_dir;
use infra_utils::path::cargo_manifest_dir;
use serde::{Deserialize, Serialize};
use serde_json::to_string_pretty;
use starknet_types_core::felt::Felt;
Expand All @@ -17,13 +17,11 @@ pub mod deploy_account;
pub mod invoke;
pub mod l1_handler;

generate_get_package_dir!();

/// Returns the path to a file in the resources directory. This assumes the package directory has a
/// `resources` folder. The value for file_path should be the path to the required file in the
/// folder "resources".
/// Returns the path to a file in the resources directory. This assumes the current working
/// directory has a `resources` folder. The value for file_path should be the path to the required
/// file in the folder "resources".
pub fn path_in_resources<P: AsRef<Path>>(file_path: P) -> PathBuf {
PathBuf::from(get_package_dir()).join("resources").join(file_path)
cargo_manifest_dir().unwrap().join("resources").join(file_path)
}

/// Reads from the directory containing the manifest at run time, same as current working directory.
Expand Down
Loading