From 5a88ba3eb9e992af78a1c52dbeed19e46378e82a Mon Sep 17 00:00:00 2001 From: SnowinterCat Date: Sat, 29 Nov 2025 10:37:38 +0800 Subject: parse_chain_of_symbolic_link --- xmake/rules/c++/modules/clang/support.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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 -- cgit v1.3.1