Revert "Fixed: nib2cib used a temp file for plutil output instead of using stdout."

This reverts commit 4e4fc389d2. It wasn't working reliably.
This commit is contained in:
Aparajita Fishman
2013-08-15 10:35:25 -04:00
parent 4e4fc389d2
commit c9dae8ced4
+12 -6
View File
@@ -109,7 +109,8 @@ ConverterConversionException = @"ConverterConversionException";
- (CPData)CPCompliantNibDataAtFilePath:(CPString)aFilePath
{
var temporaryNibFilePath = "";
var temporaryNibFilePath = "",
temporaryPlistFilePath = "";
try
{
@@ -127,14 +128,16 @@ ConverterConversionException = @"ConverterConversionException";
}
// Convert from binary plist to XML plist
var p = OS.popen(["/usr/bin/plutil", "-convert", "xml1", temporaryNibFilePath, "-o", "-"]),
plistContents;
var temporaryPlistFilePath = FILE.join("/tmp", FILE.basename(aFilePath) + ".tmp.plist");
if (p.wait() === 0)
plistContents = p.stdout.read()
else
if (OS.popen(["/usr/bin/plutil", "-convert", "xml1", temporaryNibFilePath, "-o", temporaryPlistFilePath]).wait() === 1)
[CPException raise:ConverterConversionException reason:@"Could not convert to xml plist for file: " + aFilePath];
if (!FILE.isReadable(temporaryPlistFilePath))
[CPException raise:ConverterConversionException reason:@"Unable to convert nib file."];
var plistContents = FILE.read(temporaryPlistFilePath, { charset: "UTF-8" });
// Minor NS keyed archive to CP keyed archive conversion.
// Use Java directly because rhino's string.replace is *so slow*. 4 seconds vs. 1 millisecond.
// plistContents = plistContents.replace(/\<key\>\s*CF\$UID\s*\<\/key\>/g, "<key>CP$UID</key>");
@@ -153,6 +156,9 @@ ConverterConversionException = @"ConverterConversionException";
{
if (temporaryNibFilePath !== "" && FILE.isWritable(temporaryNibFilePath))
FILE.remove(temporaryNibFilePath);
if (temporaryPlistFilePath !== "" && FILE.isWritable(temporaryPlistFilePath))
FILE.remove(temporaryPlistFilePath);
}
return [CPData dataWithRawString:plistContents];