From 970df0befc4da871cef09236f1f72135f1ce5721 Mon Sep 17 00:00:00 2001 From: sabafshin Date: Fri, 7 Aug 2026 19:30:33 +0000 Subject: [PATCH] fix: support musl static SDK (canImport Musl, no GLOB_BRACE) The Swift Static Linux SDK (musl) exposes libc as the Musl module, not Glibc. Use canImport(Musl) for the glob call, and drop GLOB_BRACE on musl (GNU extension absent from musl glob.h). Unchanged on glibc/macOS. (cherry picked from commit 2b6338aaf437a122218a704efd21aa1c9f18e26c) --- Sources/XcodeProj/Extensions/Path+Extras.swift | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Sources/XcodeProj/Extensions/Path+Extras.swift b/Sources/XcodeProj/Extensions/Path+Extras.swift index 6327ac822..63b128105 100644 --- a/Sources/XcodeProj/Extensions/Path+Extras.swift +++ b/Sources/XcodeProj/Extensions/Path+Extras.swift @@ -8,6 +8,8 @@ import PathKit func systemGlob(_ pattern: UnsafePointer!, _ flags: Int32, _ errfunc: (@convention(c) (UnsafePointer?, Int32) -> Int32)!, _ vector_ptr: UnsafeMutablePointer!) -> Int32 { #if os(macOS) || os(iOS) return Darwin.glob(pattern, flags, errfunc, vector_ptr) + #elseif os(Linux) && canImport(Musl) + return Musl.glob(pattern, flags, errfunc, vector_ptr) #else return Glibc.glob(pattern, flags, errfunc, vector_ptr) #endif @@ -35,7 +37,12 @@ extension Path { free(cPattern) } + #if os(Linux) && canImport(Musl) + // musl's glob() doesn't support brace expansion (GLOB_BRACE is a GNU extension) + let flags = GLOB_TILDE | GLOB_MARK + #else let flags = GLOB_TILDE | GLOB_BRACE | GLOB_MARK + #endif if systemGlob(cPattern, flags, nil, >) == 0 { #if os(macOS) let matchc = gt.gl_matchc