represent the current_dir as an absolute path, not a relative one. (#262)
This commit is contained in:
6
build.rs
6
build.rs
@@ -52,5 +52,9 @@ fn main()
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -548,8 +548,8 @@ fn add_module(
|
||||
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);
|
||||
@@ -568,7 +568,7 @@ fn add_non_module_code(
|
||||
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(())
|
||||
|
||||
@@ -193,8 +193,11 @@ impl SubModuleUser for IndexStore {
|
||||
|
||||
#[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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user