mirror of
https://github.com/SpaceManiac/SpacemanDMM.git
synced 2025-12-23 05:36:47 +00:00
Fix #include path resolution
It's pointless to search the current working directory because it's either the same as the .dme directory and thus shouldn't supersede the current file, or it isn't and nothing useful is likely to be found there. Fixes #111.
This commit is contained in:
parent
e6c132d12b
commit
b1fd93f5c5
1 changed files with 4 additions and 3 deletions
|
|
@ -712,10 +712,11 @@ impl<'ctx> Preprocessor<'ctx> {
|
|||
let path = PathBuf::from(path.replace("\\", "/"));
|
||||
|
||||
for candidate in vec![
|
||||
self.env_file.parent().unwrap().join(&path),
|
||||
// 1. relative to file in which `#include` appears.
|
||||
self.include_stack.top_file_path().parent().unwrap().join(&path),
|
||||
path.clone(),
|
||||
].into_iter().rev() {
|
||||
// 2. relative to root `.dme` file.
|
||||
self.env_file.parent().unwrap().join(&path),
|
||||
] {
|
||||
if !candidate.exists() {
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue