diff options
| author | SnowinterCat <[email protected]> | 2025-11-29 10:37:38 +0800 |
|---|---|---|
| committer | SnowinterCat <[email protected]> | 2025-11-29 10:37:38 +0800 |
| commit | 5a88ba3eb9e992af78a1c52dbeed19e46378e82a (patch) | |
| tree | 1b4a36e86c0facc98e8cdc359b4ad2616d9b30c3 | |
| parent | 4d1579d05f0b59be3f70a258603e34da4131373a (diff) | |
parse_chain_of_symbolic_link
| -rw-r--r-- | xmake/rules/c++/modules/clang/support.lua | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/xmake/rules/c++/modules/clang/support.lua b/xmake/rules/c++/modules/clang/support.lua index 90225f632..9447d9c97 100644 --- a/xmake/rules/c++/modules/clang/support.lua +++ b/xmake/rules/c++/modules/clang/support.lua @@ -254,6 +254,13 @@ function parse_link_files(filepath) return path.join(path.directory(filepath), target) end +function get_original_file(filepath) + while os.islink(filepath) do + filepath = parse_link_files(filepath) + end + return filepath +end + function get_stdmodules(target) local cpplib = get_cpplibrary_name(target) if cpplib then @@ -287,7 +294,7 @@ function get_stdmodules(target) return {path.normalize(path.join(try_std_module_directory, "std.cppm")), path.normalize(path.join(try_std_module_directory, "std.compat.cppm"))} end -- then try the directory relative to clang bin directory - try_std_module_directory = path.join(path.directory(parse_link_files(get_clang_path(target))), std_module_directory) + try_std_module_directory = path.join(path.directory(get_original_file(get_clang_path(target))), std_module_directory) if os.isdir(try_std_module_directory) then return {path.normalize(path.join(try_std_module_directory, "std.cppm")), path.normalize(path.join(try_std_module_directory, "std.compat.cppm"))} end |
