diff --git a/Objective-J/CommonJS/bin/cplutil b/Objective-J/CommonJS/bin/cplutil index 000e7d1be..22826b724 100755 --- a/Objective-J/CommonJS/bin/cplutil +++ b/Objective-J/CommonJS/bin/cplutil @@ -3,7 +3,7 @@ var FILE = require("file"); var SYSTEM = require("system"); var OS = require("os"); -var OBJJ = require("objective-j"); +var CFPropertyList = require("objective-j").CFPropertyList; var parser = new (require("args").Parser)(); @@ -13,8 +13,8 @@ parser.help("Cappuccino plist converter."); parser.option("-c", "--convert", "format") .help("rewrite property list files in format") .choices({ - "280north1" : OBJJ.kCFPropertyList280NorthFormat_v1_0, - "xml1": OBJJ.kCFPropertyListXMLFormat_v1_0 + "280north1" : CFPropertyList.Format280North_v1_0, + "xml1": CFPropertyList.FormatXML_v1_0 }); parser.option("-l", "--lint", "lint") @@ -50,15 +50,13 @@ exports.main = function(args) if (typeof options.format !== "undefined" || options.lint) { ok = true; - options.args.forEach(function(filePath) { - var data = new OBJJ.objj_data(); - data.string = FILE.read(filePath, { charset:"UTF-8" }); + options.args.forEach(function(filePath) + { + var plistObject = CFPropertyList.propertyListFromString(FILE.read(filePath, { charset:"UTF-8" })); - var plistObject = OBJJ.CPPropertyListCreateFromData(data); if (!plistObject) { - // FIXME: more useful error messages - SYSTEM.stderr.print(filePath + ": parse error"); + SYSTEM.stderr.print("Could not recognize format of plist at " + filePath); ok = false; return; } @@ -70,13 +68,13 @@ exports.main = function(args) } else { - data = OBJJ.CPPropertyListCreateData(plistObject, options.format); + var encodedString = CFPropertyList.stringFromPropertyList(plistObject); // outextension? if (options.outPath === "-") - SYSTEM.stdout.write(data.string); + SYSTEM.stdout.write(encodedString); else - FILE.write(options.outPath || filePath, data.string, { charset:"UTF-8" }); + FILE.write(options.outPath || filePath, encodedString, { charset:"UTF-8" }); } }); }