@@ -78,6 +78,14 @@ class BundlePlayground {
7878 #endif
7979 }
8080 }
81+
82+ var fileNameSuffix : String ? {
83+ #if os(Windows) && DEBUG
84+ " _debug "
85+ #else
86+ nil
87+ #endif
88+ }
8189
8290 var flatPathExtension : String ? {
8391 #if os(Windows)
@@ -216,7 +224,7 @@ class BundlePlayground {
216224
217225 // Make a main and an auxiliary executable:
218226 self . mainExecutableURL = bundleURL
219- . appendingPathComponent ( bundleName)
227+ . appendingPathComponent ( bundleName + ( executableType . fileNameSuffix ?? " " ) )
220228
221229 if let ext = executableType. flatPathExtension {
222230 self . mainExecutableURL. appendPathExtension ( ext)
@@ -227,7 +235,7 @@ class BundlePlayground {
227235 }
228236
229237 var auxiliaryExecutableURL = bundleURL
230- . appendingPathComponent ( auxiliaryExecutableName)
238+ . appendingPathComponent ( auxiliaryExecutableName + ( executableType . fileNameSuffix ?? " " ) )
231239
232240 if let ext = executableType. flatPathExtension {
233241 auxiliaryExecutableURL. appendPathExtension ( ext)
@@ -270,7 +278,7 @@ class BundlePlayground {
270278 // Make a main and an auxiliary executable:
271279 self . mainExecutableURL = temporaryDirectory
272280 . appendingPathComponent ( executableType. fhsPrefix)
273- . appendingPathComponent ( executableType. nonFlatFilePrefix + bundleName)
281+ . appendingPathComponent ( executableType. nonFlatFilePrefix + bundleName + ( executableType . fileNameSuffix ?? " " ) )
274282
275283 if let ext = executableType. pathExtension {
276284 self . mainExecutableURL. appendPathExtension ( ext)
@@ -280,7 +288,7 @@ class BundlePlayground {
280288 let executablesDirectory = temporaryDirectory. appendingPathComponent ( " libexec " ) . appendingPathComponent ( " \( bundleName) .executables " )
281289 try FileManager . default. createDirectory ( atPath: executablesDirectory. path, withIntermediateDirectories: true , attributes: nil )
282290 var auxiliaryExecutableURL = executablesDirectory
283- . appendingPathComponent ( executableType. nonFlatFilePrefix + auxiliaryExecutableName)
291+ . appendingPathComponent ( executableType. nonFlatFilePrefix + auxiliaryExecutableName + ( executableType . fileNameSuffix ?? " " ) )
284292
285293 if let ext = executableType. pathExtension {
286294 auxiliaryExecutableURL. appendPathExtension ( ext)
@@ -317,7 +325,7 @@ class BundlePlayground {
317325
318326 // Make a main executable:
319327 self . mainExecutableURL = temporaryDirectory
320- . appendingPathComponent ( executableType. nonFlatFilePrefix + bundleName)
328+ . appendingPathComponent ( executableType. nonFlatFilePrefix + bundleName + ( executableType . fileNameSuffix ?? " " ) )
321329
322330 if let ext = executableType. pathExtension {
323331 self . mainExecutableURL. appendPathExtension ( ext)
@@ -330,7 +338,7 @@ class BundlePlayground {
330338
331339 // Make an auxiliary executable:
332340 var auxiliaryExecutableURL = resourcesDirectory
333- . appendingPathComponent ( executableType. nonFlatFilePrefix + auxiliaryExecutableName)
341+ . appendingPathComponent ( executableType. nonFlatFilePrefix + auxiliaryExecutableName + ( executableType . fileNameSuffix ?? " " ) )
334342 if let ext = executableType. pathExtension {
335343 auxiliaryExecutableURL. appendPathExtension ( ext)
336344 }
@@ -516,11 +524,14 @@ class TestBundle : XCTestCase {
516524 XCTFail ( " should not fail to load " )
517525 }
518526
527+ // This causes a dialog box to appear on Windows which will suspend the tests, so skip testing this on Windows for now
528+ #if !os(Windows)
519529 // Executable cannot be located
520530 try ! _withEachPlaygroundLayout { ( playground) in
521531 let bundle = Bundle ( path: playground. bundlePath)
522532 XCTAssertThrowsError ( try bundle!. loadAndReturnError ( ) )
523533 }
534+ #endif
524535 }
525536
526537 func test_bundleWithInvalidPath( ) {
@@ -531,12 +542,15 @@ class TestBundle : XCTestCase {
531542 func test_bundlePreflight( ) {
532543 XCTAssertNoThrow ( try testBundle ( executable: true ) . preflight ( ) )
533544
545+ // Windows DLL bundles are always executable
546+ #if !os(Windows)
534547 try ! _withEachPlaygroundLayout { ( playground) in
535548 let bundle = Bundle ( path: playground. bundlePath) !
536549
537550 // Must throw as the main executable is a dummy empty file.
538551 XCTAssertThrowsError ( try bundle. preflight ( ) )
539552 }
553+ #endif
540554 }
541555
542556 func test_bundleFindExecutable( ) {
0 commit comments