File tree 1 file changed +9
-4
lines changed
1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -277,12 +277,17 @@ class TestFileManager : XCTestCase {
277
277
try fm. setAttributes ( [ . posixPermissions : NSNumber ( value: Int16 ( 0o0000 ) ) ] , ofItemAtPath: path)
278
278
XCTAssertFalse ( fm. isExecutableFile ( atPath: path) )
279
279
280
- // test executable if file has execute permissions
281
- try fm. setAttributes ( [ . posixPermissions : NSNumber ( value: Int16 ( 0o0100 ) ) ] , ofItemAtPath: path)
282
280
#if os(Windows)
283
- // a Windows executable needs to be binary
284
- XCTAssertFalse ( fm. isExecutableFile ( atPath: path) )
281
+ // test against cmd.exe
282
+ let systemDir : String = {
283
+ var buffer = Array < WCHAR > ( repeating: 0 , count: Int ( MAX_PATH + 1 ) )
284
+ GetSystemDirectoryW ( & buffer, . init( MAX_PATH + 1 ) )
285
+ return String ( decodingCString: buffer, as: UTF16 . self)
286
+ } ( )
287
+ XCTAssertTrue ( fm. isExecutableFile ( atPath: " \( systemDir) \\ cmd.exe " ) )
285
288
#else
289
+ // test executable if file has execute permissions
290
+ try fm. setAttributes ( [ . posixPermissions : NSNumber ( value: Int16 ( 0o0100 ) ) ] , ofItemAtPath: path)
286
291
XCTAssertTrue ( fm. isExecutableFile ( atPath: path) )
287
292
#endif
288
293
} catch let e {
You can’t perform that action at this time.
0 commit comments