@@ -78,6 +78,14 @@ class BundlePlayground {
78
78
#endif
79
79
}
80
80
}
81
+
82
+ var fileNameSuffix : String ? {
83
+ #if os(Windows) && DEBUG
84
+ " _debug "
85
+ #else
86
+ nil
87
+ #endif
88
+ }
81
89
82
90
var flatPathExtension : String ? {
83
91
#if os(Windows)
@@ -216,7 +224,7 @@ class BundlePlayground {
216
224
217
225
// Make a main and an auxiliary executable:
218
226
self . mainExecutableURL = bundleURL
219
- . appendingPathComponent ( bundleName)
227
+ . appendingPathComponent ( bundleName + ( executableType . fileNameSuffix ?? " " ) )
220
228
221
229
if let ext = executableType. flatPathExtension {
222
230
self . mainExecutableURL. appendPathExtension ( ext)
@@ -227,7 +235,7 @@ class BundlePlayground {
227
235
}
228
236
229
237
var auxiliaryExecutableURL = bundleURL
230
- . appendingPathComponent ( auxiliaryExecutableName)
238
+ . appendingPathComponent ( auxiliaryExecutableName + ( executableType . fileNameSuffix ?? " " ) )
231
239
232
240
if let ext = executableType. flatPathExtension {
233
241
auxiliaryExecutableURL. appendPathExtension ( ext)
@@ -270,7 +278,7 @@ class BundlePlayground {
270
278
// Make a main and an auxiliary executable:
271
279
self . mainExecutableURL = temporaryDirectory
272
280
. appendingPathComponent ( executableType. fhsPrefix)
273
- . appendingPathComponent ( executableType. nonFlatFilePrefix + bundleName)
281
+ . appendingPathComponent ( executableType. nonFlatFilePrefix + bundleName + ( executableType . fileNameSuffix ?? " " ) )
274
282
275
283
if let ext = executableType. pathExtension {
276
284
self . mainExecutableURL. appendPathExtension ( ext)
@@ -280,7 +288,7 @@ class BundlePlayground {
280
288
let executablesDirectory = temporaryDirectory. appendingPathComponent ( " libexec " ) . appendingPathComponent ( " \( bundleName) .executables " )
281
289
try FileManager . default. createDirectory ( atPath: executablesDirectory. path, withIntermediateDirectories: true , attributes: nil )
282
290
var auxiliaryExecutableURL = executablesDirectory
283
- . appendingPathComponent ( executableType. nonFlatFilePrefix + auxiliaryExecutableName)
291
+ . appendingPathComponent ( executableType. nonFlatFilePrefix + auxiliaryExecutableName + ( executableType . fileNameSuffix ?? " " ) )
284
292
285
293
if let ext = executableType. pathExtension {
286
294
auxiliaryExecutableURL. appendPathExtension ( ext)
@@ -317,7 +325,7 @@ class BundlePlayground {
317
325
318
326
// Make a main executable:
319
327
self . mainExecutableURL = temporaryDirectory
320
- . appendingPathComponent ( executableType. nonFlatFilePrefix + bundleName)
328
+ . appendingPathComponent ( executableType. nonFlatFilePrefix + bundleName + ( executableType . fileNameSuffix ?? " " ) )
321
329
322
330
if let ext = executableType. pathExtension {
323
331
self . mainExecutableURL. appendPathExtension ( ext)
@@ -330,7 +338,7 @@ class BundlePlayground {
330
338
331
339
// Make an auxiliary executable:
332
340
var auxiliaryExecutableURL = resourcesDirectory
333
- . appendingPathComponent ( executableType. nonFlatFilePrefix + auxiliaryExecutableName)
341
+ . appendingPathComponent ( executableType. nonFlatFilePrefix + auxiliaryExecutableName + ( executableType . fileNameSuffix ?? " " ) )
334
342
if let ext = executableType. pathExtension {
335
343
auxiliaryExecutableURL. appendPathExtension ( ext)
336
344
}
@@ -516,11 +524,14 @@ class TestBundle : XCTestCase {
516
524
XCTFail ( " should not fail to load " )
517
525
}
518
526
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)
519
529
// Executable cannot be located
520
530
try ! _withEachPlaygroundLayout { ( playground) in
521
531
let bundle = Bundle ( path: playground. bundlePath)
522
532
XCTAssertThrowsError ( try bundle!. loadAndReturnError ( ) )
523
533
}
534
+ #endif
524
535
}
525
536
526
537
func test_bundleWithInvalidPath( ) {
@@ -531,12 +542,15 @@ class TestBundle : XCTestCase {
531
542
func test_bundlePreflight( ) {
532
543
XCTAssertNoThrow ( try testBundle ( executable: true ) . preflight ( ) )
533
544
545
+ // Windows DLL bundles are always executable
546
+ #if !os(Windows)
534
547
try ! _withEachPlaygroundLayout { ( playground) in
535
548
let bundle = Bundle ( path: playground. bundlePath) !
536
549
537
550
// Must throw as the main executable is a dummy empty file.
538
551
XCTAssertThrowsError ( try bundle. preflight ( ) )
539
552
}
553
+ #endif
540
554
}
541
555
542
556
func test_bundleFindExecutable( ) {
0 commit comments