}
libraries.write_all(b"\n\n m\n };
-}").unwrap();
+}\n").unwrap();
+
+ libraries.write_all(b"\npub static PROJECT_DIR: &'static str = \"").unwrap();
+ libraries.write_all(env::var("CARGO_MANIFEST_DIR").unwrap().as_bytes()).unwrap();
+ libraries.write_all(b"\";\n").unwrap();
}
term_dir: TermDir,
) {
module.code_dir.extend(indices.code_dir);
- module.op_dir.extend(indices.op_dir.into_iter());
- module.term_dir.extend(term_dir.into_iter());
+ module.op_dir.extend(indices.op_dir);
+ module.term_dir.extend(term_dir);
wam.add_in_situ_module_dir(indices.module_dir);
wam.add_module(module);
clause_code_generator.generate_clause_code(&dynamic_clause_map, wam)?;
add_toplevel(wam, indices, term_dir);
- wam.code_repo.code.extend(code.into_iter());
+ wam.code_repo.code.extend(code);
clause_code_generator.add_clause_code(wam, dynamic_clause_map);
Ok(())
#[inline]
fn current_dir() -> std::path::PathBuf {
- let mut path_buf = std::path::PathBuf::from(file!());
- path_buf.pop();
+ let mut path_buf = std::path::PathBuf::from(PROJECT_DIR);
+ // file!() always produces a path relative to PROJECT_DIR.
+ path_buf = path_buf.join(std::path::PathBuf::from(file!()));
+
+ path_buf.pop();
path_buf
}