//
//  GenStringsCommander.swift
//  BartyCrouch
//
//  Created by Cihat Gündüz on 03.05.16.
//  Copyright © 2016 Flinesoft. All rights reserved.
//

import Foundation

/// Sends `genstrings` commands with specified input/output paths to bash.
public class GenStringsCommander {

    // MARK: - Stored Class Properties

    public static let sharedInstance = GenStringsCommander()


    // MARK: - Instance Methods

    public func export(stringsFilesToPath stringsFilePath: String, fromCodeInDirectoryPath codeDirectoryPath: String) -> Bool {
        let findFilesResult = Commander.sharedInstance.run("/usr/bin/find", arguments:
            [codeDirectoryPath, "-name", "*.[hm]", "-o", "-name", "*.mm", "-o", "-name", "*.swift"])

        let exportFileResult = Commander.sharedInstance.run("/usr/bin/genstrings", arguments: findFilesResult.outputs + ["-o", stringsFilePath])

        if findFilesResult.exitCode == 0 && exportFileResult.exitCode == 0 {
            return true
        } else {
            return false
        }
    }

}

//
//  GenStringsCommander.swift
//  BartyCrouch
//
//  Created by Cihat Gündüz on 03.05.16.
//  Copyright © 2016 Flinesoft. All rights reserved.
//

import Foundation

/// Sends `genstrings` commands with specified input/output paths to bash.
public class GenStringsCommander {

    // MARK: - Stored Class Properties

    public static let sharedInstance = GenStringsCommander()


    // MARK: - Instance Methods

    public func export(stringsFilesToPath stringsFilePath: String, fromCodeInDirectoryPath codeDirectoryPath: String) -> Bool {
        let findFilesResult = Commander.sharedInstance.run("/usr/bin/find", arguments:
            [codeDirectoryPath, "-name", "'*.[hm]'", "-o", "-name", "'*.mm'", "-o", "-name", "'*.swift'", "-print"])
        let exportFileResult = Commander.sharedInstance.run("/usr/bin/genstrings", arguments: findFilesResult.outputs + ["-o", stringsFilePath])

        if findFilesResult.exitCode == 0 && exportFileResult.exitCode == 0 {
            return true
        } else {
            return false
        }
    }

}

--- 
+++ 
@@ -20,7 +20,8 @@
 
     public func export(stringsFilesToPath stringsFilePath: String, fromCodeInDirectoryPath codeDirectoryPath: String) -> Bool {
         let findFilesResult = Commander.sharedInstance.run("/usr/bin/find", arguments:
-            [codeDirectoryPath, "-name", "'*.[hm]'", "-o", "-name", "'*.mm'", "-o", "-name", "'*.swift'", "-print"])
+            [codeDirectoryPath, "-name", "*.[hm]", "-o", "-name", "*.mm", "-o", "-name", "*.swift"])
+
         let exportFileResult = Commander.sharedInstance.run("/usr/bin/genstrings", arguments: findFilesResult.outputs + ["-o", stringsFilePath])
 
         if findFilesResult.exitCode == 0 && exportFileResult.exitCode == 0 {
Fix tests for whitespaces in paths
