         else {
             return image.saveTo(file)
         }
+    }
+    
+    func saveString(data:String, file: String) -> Bool
+    {
+        do {
+            try data.writeToFile(file, atomically: true, encoding: NSUTF8StringEncoding)
+        }
+        catch {
+            print("Error: writing to \(file)")
+            exit(-1)
+        }
+        return true
     }
     
     private func writeImageStringArray(stringArray: Dictionary<String, AnyObject>, type: LangType) -> String {

        print(" -asset_template [basename]          creates a json template, specificly for the assets")
        print(" -config_template [file.json]        creates a json template, specificly for the app")
        print(" -config [file.json]                 use config file for options, instead of command line")
        print(" -input [file.json]                  asset json file")
        print(" -inputs [file1.json file2.json ...] merges asset files and process")
        print(" -input_assets [folder]              asset source folder (read)")

                genString.appendContentsOf("\n}")
            }
            outputStr.appendContentsOf(genString + "\n")
            saveString(outputStr, file: langOutputFile)
        }
    }

