Remove all use of Objective-C.

This commit is contained in:
Kare Morstol
2016-05-25 02:39:44 +02:00
parent 12bfb64c31
commit ed6bc3ec6c
5 changed files with 4 additions and 85 deletions
+4 -9
View File
@@ -145,15 +145,10 @@ extension NSTask {
- throws: ShellError.InAccessibleExecutable if command could not be executed.
*/
public func launchThrowably() throws {
#if SWIFT_PACKAGE
launch()
#else
do {
try launchWithNSError()
} catch {
throw ShellError.InAccessibleExecutable(path: self.launchPath!)
}
#endif
guard Files.isExecutableFile(atPath: self.launchPath!) else {
throw ShellError.InAccessibleExecutable(path: self.launchPath!)
}
launch()
}
/**
-14
View File
@@ -1,14 +0,0 @@
/*
* Released under the MIT License (MIT), http://opensource.org/licenses/MIT
*
* Copyright (c) 2015 Kåre Morstøl, NotTooBad Software (nottoobadsoftware.com)
*
*/
#import <Foundation/Foundation.h>
@interface NSTask (NSTask_Errors)
- (BOOL) launchWithNSError: (NSError**) error;
@end
-27
View File
@@ -1,27 +0,0 @@
/*
* Released under the MIT License (MIT), http://opensource.org/licenses/MIT
*
* Copyright (c) 2015 Kåre Morstøl, NotTooBad Software (nottoobadsoftware.com)
*
*/
#import "NSTask+NSTask_Errors.h"
@implementation NSTask (NSTask_Errors)
- (BOOL) launchWithNSError:(NSError *__autoreleasing *)error {
@try {
[self launch];
}
@catch (NSException *exception) {
if ([exception.name isEqualToString:NSInvalidArgumentException]) {
*error = [NSError errorWithDomain:NSPOSIXErrorDomain code:1 userInfo:exception.userInfo];
return false;
} else {
@throw exception;
}
}
return true;
}
@end
@@ -1,13 +0,0 @@
/*
* Released under the MIT License (MIT), http://opensource.org/licenses/MIT
*
* Copyright (c) 2015 Kåre Morstøl, NotTooBad Software (nottoobadsoftware.com)
*
*/
#ifndef SwiftShell_Bridging_Header_h
#define SwiftShell_Bridging_Header_h
#import "NSTask+NSTask_Errors.h"
#endif /* SwiftShell_Bridging_Header_h */
-22
View File
@@ -28,9 +28,6 @@
BAE4F5681B9F838E00908543 /* Bash.swift in Sources */ = {isa = PBXBuildFile; fileRef = BAE4F5671B9F838E00908543 /* Bash.swift */; };
BAE503881BAF1061005261A6 /* Array.swift in Sources */ = {isa = PBXBuildFile; fileRef = BAE503871BAF1061005261A6 /* Array.swift */; };
BAE5038B1BAF1231005261A6 /* Array_Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BAE5038A1BAF1231005261A6 /* Array_Tests.swift */; };
BAEDDA4C1BB3582B00BD28B2 /* NSTask+NSTask_Errors.h in Headers */ = {isa = PBXBuildFile; fileRef = BAEDDA4A1BB3582B00BD28B2 /* NSTask+NSTask_Errors.h */; };
BAEDDA4D1BB3582B00BD28B2 /* NSTask+NSTask_Errors.m in Sources */ = {isa = PBXBuildFile; fileRef = BAEDDA4B1BB3582B00BD28B2 /* NSTask+NSTask_Errors.m */; };
BAEDDA4F1BB36EE200BD28B2 /* SwiftShell-Bridging-Header.h in Headers */ = {isa = PBXBuildFile; fileRef = BAEDDA4E1BB36EE200BD28B2 /* SwiftShell-Bridging-Header.h */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@@ -69,9 +66,6 @@
BAE4F5671B9F838E00908543 /* Bash.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Bash.swift; sourceTree = "<group>"; };
BAE503871BAF1061005261A6 /* Array.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Array.swift; path = General/Array.swift; sourceTree = "<group>"; };
BAE5038A1BAF1231005261A6 /* Array_Tests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Array_Tests.swift; path = General/Array_Tests.swift; sourceTree = "<group>"; };
BAEDDA4A1BB3582B00BD28B2 /* NSTask+NSTask_Errors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSTask+NSTask_Errors.h"; sourceTree = "<group>"; };
BAEDDA4B1BB3582B00BD28B2 /* NSTask+NSTask_Errors.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSTask+NSTask_Errors.m"; sourceTree = "<group>"; };
BAEDDA4E1BB36EE200BD28B2 /* SwiftShell-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "SwiftShell-Bridging-Header.h"; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -134,7 +128,6 @@
BA2E3B311B5C35CC001ED175 /* Stream.swift */,
BAE503861BAF104C005261A6 /* General */,
BA2E3B1A1B5C34DD001ED175 /* Info.plist */,
BAEDDA501BB37B9200BD28B2 /* NSTask */,
);
name = Sources;
path = Sources/SwiftShell;
@@ -174,16 +167,6 @@
name = General;
sourceTree = "<group>";
};
BAEDDA501BB37B9200BD28B2 /* NSTask */ = {
isa = PBXGroup;
children = (
BAEDDA4A1BB3582B00BD28B2 /* NSTask+NSTask_Errors.h */,
BAEDDA4B1BB3582B00BD28B2 /* NSTask+NSTask_Errors.m */,
BAEDDA4E1BB36EE200BD28B2 /* SwiftShell-Bridging-Header.h */,
);
name = NSTask;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
@@ -191,8 +174,6 @@
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
BAEDDA4F1BB36EE200BD28B2 /* SwiftShell-Bridging-Header.h in Headers */,
BAEDDA4C1BB3582B00BD28B2 /* NSTask+NSTask_Errors.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -301,7 +282,6 @@
BA2E3B501B5C450C001ED175 /* Context.swift in Sources */,
BA2E3B351B5C35CC001ED175 /* Files.swift in Sources */,
BAE503881BAF1061005261A6 /* Array.swift in Sources */,
BAEDDA4D1BB3582B00BD28B2 /* NSTask+NSTask_Errors.m in Sources */,
BA2E3B371B5C35CC001ED175 /* Stream.swift in Sources */,
BAE4F5681B9F838E00908543 /* Bash.swift in Sources */,
);
@@ -403,7 +383,6 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
SKIP_INSTALL = NO;
SWIFT_OBJC_BRIDGING_HEADER = "Sources/SwiftShell/SwiftShell-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
@@ -455,7 +434,6 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
SKIP_INSTALL = NO;
SWIFT_OBJC_BRIDGING_HEADER = "Sources/SwiftShell/SwiftShell-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";