File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,13 @@ import PackageLoading
16
16
import Foundation
17
17
import SPMBuildCore
18
18
19
+ extension AbsolutePath {
20
+ fileprivate var asSwiftStringLiteralConstant : String {
21
+ return self . pathString. unicodeScalars
22
+ . reduce ( " " , { $0 + $1. escaped ( asASCII: false ) } )
23
+ }
24
+ }
25
+
19
26
extension BuildParameters {
20
27
/// Returns the directory to be used for module cache.
21
28
public var moduleCache : AbsolutePath {
@@ -576,13 +583,17 @@ public final class SwiftTargetBuildDescription {
576
583
guard let bundlePath = self . bundlePath else { return }
577
584
578
585
let stream = BufferedOutputByteStream ( )
586
+
587
+ let mainPath : AbsolutePath =
588
+ AbsolutePath ( Bundle . main. bundlePath) . appending ( component: bundlePath. basename)
589
+
579
590
stream <<< """
580
591
import class Foundation.Bundle
581
592
582
593
extension Foundation.Bundle {
583
594
static var module: Bundle = {
584
- let mainPath = Bundle.main.bundlePath + " / " + " \( bundlePath . basename ) "
585
- let buildPath = " \( bundlePath. pathString ) "
595
+ let mainPath = " \( mainPath . asSwiftStringLiteralConstant ) "
596
+ let buildPath = " \( bundlePath. asSwiftStringLiteralConstant ) "
586
597
587
598
let preferredBundle = Bundle(path: mainPath)
588
599
You can’t perform that action at this time.
0 commit comments