emulator: imports work relatively to file being assembled (set cwd)
This commit is contained in:
@@ -66,7 +66,7 @@ fn generate_symbol_table(nodes: &[Node]) -> Result<HashMap<Symbol, u32>, Assembl
|
||||
}
|
||||
|
||||
pub fn resolve_dependencies(mut nodes: Vec<Node>) -> Result<Vec<Node>, AssembleError> {
|
||||
// first we get a list of imports
|
||||
// First we get a list of imports.
|
||||
let mut dependencies = Vec::new();
|
||||
for node in &nodes {
|
||||
if let Opcode::Include = node.opcode() {
|
||||
@@ -81,7 +81,11 @@ pub fn resolve_dependencies(mut nodes: Vec<Node>) -> Result<Vec<Node>, AssembleE
|
||||
} else {
|
||||
unreachable!()
|
||||
};
|
||||
let hash = quick_hash(&PathBuf::from(path).canonicalize().unwrap());
|
||||
let hash = quick_hash(
|
||||
&PathBuf::from(path)
|
||||
.canonicalize()
|
||||
.expect("ERROR: Invalid import path."),
|
||||
);
|
||||
|
||||
dependencies.push((name, hash));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user