diff --git a/Sources/SKSwiftPMWorkspace/SwiftPMWorkspace.swift b/Sources/SKSwiftPMWorkspace/SwiftPMWorkspace.swift index ff200a94..60130fa8 100644 --- a/Sources/SKSwiftPMWorkspace/SwiftPMWorkspace.swift +++ b/Sources/SKSwiftPMWorkspace/SwiftPMWorkspace.swift @@ -378,7 +378,11 @@ extension SwiftPMWorkspace { var args = td.basicArguments() - let compilePath = td.compilePaths().first(where: { $0.source == path }) + let nativePath: AbsolutePath = + URL(fileURLWithPath: path.pathString).withUnsafeFileSystemRepresentation { + AbsolutePath(String(cString: $0!)) + } + let compilePath = td.compilePaths().first(where: { $0.source == nativePath }) if let compilePath = compilePath { args += [ "-MD", diff --git a/Tests/SKSwiftPMWorkspaceTests/SwiftPMWorkspaceTests.swift b/Tests/SKSwiftPMWorkspaceTests/SwiftPMWorkspaceTests.swift index 8b318d4b..eb182158 100644 --- a/Tests/SKSwiftPMWorkspaceTests/SwiftPMWorkspaceTests.swift +++ b/Tests/SKSwiftPMWorkspaceTests/SwiftPMWorkspaceTests.swift @@ -365,16 +365,27 @@ final class SwiftPMWorkspaceTests: XCTestCase { let args = ws.settings(for: acxx.asURI, .cpp)!.compilerArguments checkArgsCommon(args) - check("-MD", "-MT", "dependencies", - "-MF", build.appending(components: "lib.build", "a.cpp.d").pathString, - arguments: args) - check("-c", acxx.pathString, arguments: args) - check("-o", build.appending(components: "lib.build", "a.cpp.o").pathString, arguments: args) + + URL(fileURLWithPath: build.appending(components: "lib.build", "a.cpp.d").pathString) + .withUnsafeFileSystemRepresentation { + check("-MD", "-MT", "dependencies", "-MF", String(cString: $0!), arguments: args) + } + + URL(fileURLWithPath: acxx.pathString).withUnsafeFileSystemRepresentation { + check("-c", String(cString: $0!), arguments: args) + } + + URL(fileURLWithPath: build.appending(components: "lib.build", "a.cpp.o").pathString) + .withUnsafeFileSystemRepresentation { + check("-o", String(cString: $0!), arguments: args) + } let header = packageRoot.appending(components: "Sources", "lib", "include", "a.h") let headerArgs = ws.settings(for: header.asURI, .cpp)!.compilerArguments checkArgsCommon(headerArgs) - check("-c", "-x", "c++-header", header.pathString, arguments: headerArgs) + + check("-c", "-x", "c++-header", URL(fileURLWithPath: header.pathString).path, + arguments: headerArgs) } }