From e3e377d20acec969a8a2f09da7ca4cdd8f1b7aa5 Mon Sep 17 00:00:00 2001 From: Madpwnhammer Date: Fri, 30 Jun 2023 16:07:52 +0300 Subject: [PATCH] Added rel path support to BHL_REF module --- bhl_macro.inc.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/bhl_macro.inc.php b/bhl_macro.inc.php index ab7b8a4..c87dcf4 100644 --- a/bhl_macro.inc.php +++ b/bhl_macro.inc.php @@ -5,6 +5,24 @@ */ function macro_BHL_REF($proc, $module, $func, $signature_json = '') { + if($module[0] !== '/') + { + $abs_module = \taskman\normalize_path(dirname($proc->getRootFile()) . '/' . $module); + $mapped = false; + foreach(\taskman\bhl_proj()->src_dirs as $dir) + { + $rel_module = str_replace(\taskman\normalize_path($dir), '', $abs_module); + if($rel_module != $abs_module) + { + $mapped = true; + $module = "/" . $rel_module; + break; + } + } + if(!$mapped) + throw new Exception("Could not map relative module: $module"); + } + $module_file = \taskman\bhl_map_module_to_file($module); if(!$module_file) throw new Exception("Module not found '{$module}'");