Skip to content

Commit 29231bc

Browse files
committed
use CARGO_RUSTC_CURRENT_DIR
1 parent cf602d6 commit 29231bc

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

attr/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,12 @@ impl Intermediate {
102102
}
103103

104104
pub fn schema_from_filepaths(paths: &[&Path]) -> anyhow::Result<OrmliteSchema> {
105-
let cwd = env::var("CARGO_MANIFEST_DIR")
105+
let cwd = env::var("CARGO_RUSTC_CURRENT_DIR")
106+
.or_else(|_| env::var("CARGO_MANIFEST_DIR"))
106107
.map(PathBuf::from)
107108
.or_else(|_| env::current_dir())
108109
.expect("Failed to get current directory for schema");
110+
109111
let paths = paths.iter().map(|p| cwd.join(p)).collect::<Vec<_>>();
110112
let invalid_paths = paths.iter().filter(|p| fs::metadata(p).is_err()).collect::<Vec<_>>();
111113
if !invalid_paths.is_empty() {

0 commit comments

Comments
 (0)