Added CommonJS extensions to CFPropertyList.

Reviewed by me.
This commit is contained in:
Francisco Ryan Tolmasky I committed 2010-02-18 15:28:30 -08:00
1 parent b078169adf
commit 94d3053232
1 file changed
+12
+12
View File
@@ -60,6 +60,18 @@ CFPropertyList.stringFromPropertyList = function(/*CFPropertyList*/ aPropertyLis
serializers["finish"]();
}
#ifdef COMMONJS
CFPropertyList.readPropertyListFromFile = function(/*String*/ aFilePath)
{
return CFPropertyList.propertyListFromString(FILE.read(aFilePath, { charset:"UTF-8" }));
}
CFPropertyList.writePropertyListToFile = function(/*CFPropertyList*/ aPropertyList, /*String*/ aFilePath)
{
return FILE.write(aFilePath, CFPropertyList.stringFromPropertyList(aPropertyList), { charset:"UTF-8" });
}
#endif
function serializePropertyList(/*CFPropertyList*/ aPropertyList, /*Object*/ serializers)
{
var type = typeof aPropertyList,