mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-01 16:33:35 +00:00
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:
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user