| 78 | } |
| 79 | |
| 80 | function findIncludeFile(filename, currentDir) { |
| 81 | if (path.isAbsolute(filename)) { |
| 82 | return existsSync(filename) ? filename : null; |
| 83 | } |
| 84 | |
| 85 | // Search for include files either relative to the including file, |
| 86 | // or in the src root directory. |
| 87 | const includePath = [currentDir, srcDir]; |
| 88 | for (const p of includePath) { |
| 89 | const f = path.join(p, filename); |
| 90 | if (existsSync(f)) { |
| 91 | return f; |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | return null; |
| 96 | } |
| 97 | |
| 98 | // Simple #if/else/endif preprocessing for a file. Checks if the |
| 99 | // ident checked is true in our global. |