From 798058354ab4772e81ed9dbe58f8404e9e42ecba Mon Sep 17 00:00:00 2001 From: Tae Won Ha Date: Fri, 26 Aug 2016 17:45:58 +0200 Subject: [PATCH] Remove unused stuff --- SwiftNeoVim/NeoVimAgent.h | 2 +- SwiftNeoVim/NeoVimAgent.m | 2 +- SwiftNeoVim/NeoVimView.swift | 2 +- SwiftNeoVim/ShellUtils.swift | 50 ---------------------------------- VimR.xcodeproj/project.pbxproj | 4 --- 5 files changed, 3 insertions(+), 57 deletions(-) delete mode 100644 SwiftNeoVim/ShellUtils.swift diff --git a/SwiftNeoVim/NeoVimAgent.h b/SwiftNeoVim/NeoVimAgent.h index d4cb7508..6b6a4474 100644 --- a/SwiftNeoVim/NeoVimAgent.h +++ b/SwiftNeoVim/NeoVimAgent.h @@ -19,7 +19,7 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)initWithUuid:(NSString *)uuid; - (void)quit; -- (bool)runLocalServerAndNeoVimWithPath:(NSString *)path; +- (bool)runLocalServerAndNeoVim; - (void)vimCommand:(NSString *)string; diff --git a/SwiftNeoVim/NeoVimAgent.m b/SwiftNeoVim/NeoVimAgent.m index 07a2edc6..b88a3e23 100644 --- a/SwiftNeoVim/NeoVimAgent.m +++ b/SwiftNeoVim/NeoVimAgent.m @@ -119,7 +119,7 @@ static CFDataRef local_server_callback(CFMessagePortRef local, SInt32 msgid, CFD [_neoVimServerTask launch]; } -- (bool)runLocalServerAndNeoVimWithPath:(NSString *)path { +- (bool)runLocalServerAndNeoVim { _localServerThread = [[NSThread alloc] initWithTarget:self selector:@selector(runLocalServer) object:nil]; [_localServerThread start]; diff --git a/SwiftNeoVim/NeoVimView.swift b/SwiftNeoVim/NeoVimView.swift index 2c20b1b1..3840ab51 100644 --- a/SwiftNeoVim/NeoVimView.swift +++ b/SwiftNeoVim/NeoVimView.swift @@ -112,7 +112,7 @@ public class NeoVimView: NSView, NSUserInterfaceValidations { // We cannot set bridge in init since self is not available before super.init()... self.agent.bridge = self - let noErrorDuringInitialization = self.agent.runLocalServerAndNeoVimWithPath(ShellUtils.pathForUserShell()) + let noErrorDuringInitialization = self.agent.runLocalServerAndNeoVim() // Neovim is ready now: resize neovim to bounds. DispatchUtils.gui { diff --git a/SwiftNeoVim/ShellUtils.swift b/SwiftNeoVim/ShellUtils.swift deleted file mode 100644 index 2e33c121..00000000 --- a/SwiftNeoVim/ShellUtils.swift +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Tae Won Ha - http://taewon.de - @hataewon - * See LICENSE - */ - -import Foundation - -class ShellUtils { - - static let defaultPath = "/usr/local/bin:/opt/local/bin:/opt/bin:/usr/bin:/bin:/usr/sbin:/sbin" - - private static let cmdForPath = "env | grep '^PATH=' | sed 's/^PATH=//'" - - static func run(command command: String, arguments: [String] = []) -> String? { - let pipe = NSPipe() - - let task = NSTask() - task.standardOutput = pipe - task.launchPath = command - task.arguments = arguments - - task.launch() - let file = pipe.fileHandleForReading; - let data = file.readDataToEndOfFile() - file.closeFile() - - let output = NSString(data: data, encoding: NSUTF8StringEncoding) - return output?.stringByTrimmingCharactersInSet(NSCharacterSet.whitespaceAndNewlineCharacterSet()) - } - - static func pathForUserShell() -> String { - guard let shell = NSProcessInfo.processInfo().environment["SHELL"] else { - return ShellUtils.defaultPath - } - - let shellUrl = NSURL(fileURLWithPath: shell) - guard let shellPath = shellUrl.path else { - return ShellUtils.defaultPath - } - - var shellOptions = [String]() - if shellUrl.lastPathComponent != "tsch" { - shellOptions.append("-l") // tsch allows the -l option only for interactive shell - } - shellOptions.append("-c") - shellOptions.append(ShellUtils.cmdForPath) - - return ShellUtils.run(command: shellPath, arguments: shellOptions) ?? ShellUtils.defaultPath - } -} \ No newline at end of file diff --git a/VimR.xcodeproj/project.pbxproj b/VimR.xcodeproj/project.pbxproj index cbfc9b2e..915171b1 100644 --- a/VimR.xcodeproj/project.pbxproj +++ b/VimR.xcodeproj/project.pbxproj @@ -48,7 +48,6 @@ 4B6A709A1D65058A00E12030 /* Quick.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B56F29C1D29926600C1F92E /* Quick.framework */; }; 4B6A709C1D6507A000E12030 /* Nimble.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4B56F29B1D29926600C1F92E /* Nimble.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 4B6A709D1D6507A000E12030 /* Quick.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4B56F29C1D29926600C1F92E /* Quick.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - 4B6A709F1D660CDA00E12030 /* ShellUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B6A709E1D660CDA00E12030 /* ShellUtils.swift */; }; 4B854A1D1D31447C00E08DE1 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B854A1C1D31447C00E08DE1 /* main.m */; }; 4B97E2CC1D33F53D00FC0660 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4B97E2CE1D33F53D00FC0660 /* MainWindow.xib */; }; 4B9A15241D2993DA009F9F67 /* Nimble.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4B56F29B1D29926600C1F92E /* Nimble.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; @@ -215,7 +214,6 @@ 4B570DC11D303CAF006EDC21 /* NeoVimAgent.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NeoVimAgent.m; sourceTree = ""; }; 4B6A70931D60E04200E12030 /* CocoaExtensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CocoaExtensions.swift; sourceTree = ""; }; 4B6A70951D6100E300E12030 /* SwiftCommons.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwiftCommons.swift; sourceTree = ""; }; - 4B6A709E1D660CDA00E12030 /* ShellUtils.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ShellUtils.swift; sourceTree = ""; }; 4B854A1A1D31447C00E08DE1 /* NeoVimServer */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = NeoVimServer; sourceTree = BUILT_PRODUCTS_DIR; }; 4B854A1C1D31447C00E08DE1 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 4B97E2CD1D33F53D00FC0660 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainWindow.xib; sourceTree = ""; }; @@ -343,7 +341,6 @@ 4BEE79131D16D1C60012EDAA /* NeoVimView */, 4BEE79161D16D3800012EDAA /* CellAttributes.swift */, 1929BA6128BFDD54CA92F46E /* ColorUtils.swift */, - 4B6A709E1D660CDA00E12030 /* ShellUtils.swift */, 4B2A2BF91D0351810074CE9A /* SwiftNeoVim.h */, 4BDF641A1D0887C100D47E1D /* TextDrawer.h */, 4BDF641B1D0887C100D47E1D /* TextDrawer.m */, @@ -717,7 +714,6 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 4B6A709F1D660CDA00E12030 /* ShellUtils.swift in Sources */, 4BEE79171D16D3800012EDAA /* CellAttributes.swift in Sources */, 4BF6E29C1D34153C0053FA76 /* KeyUtils.swift in Sources */, 4BCADE081D11ED12004DAD0F /* CocoaExtensions.swift in Sources */,