nib2cib Converter.j : Add a flag to disable ibtool step in case the input is already compiled. Set SharedConverter class var in init (not a singleton, represents the current Converter).

This commit is contained in:
cacaodev
2012-04-13 09:18:54 +02:00
parent c028c0ad26
commit 392702cc18
+13 -4
View File
@@ -46,6 +46,7 @@ ConverterConversionException = @"ConverterConversionException";
NibFormat format @accessors(readonly);
CPArray themes @accessors(readonly);
CPArray userNSClasses @accessors;
BOOL compileNib @accessors;
}
+ (Converter)sharedConverter
@@ -63,6 +64,7 @@ ConverterConversionException = @"ConverterConversionException";
inputPath = aPath;
format = nibFormat;
themes = themeList;
compileNib = YES;
}
return self;
@@ -114,11 +116,18 @@ ConverterConversionException = @"ConverterConversionException";
try
{
// Compile xib or nib to make sure we have a non-new format nib.
temporaryNibFilePath = FILE.join("/tmp", FILE.basename(aFilePath) + ".tmp.nib");
if (compileNib)
{
// Compile xib or nib to make sure we have a non-new format nib.
temporaryNibFilePath = FILE.join("/tmp", FILE.basename(aFilePath) + ".tmp.nib");
if (OS.popen(["/usr/bin/ibtool", aFilePath, "--compile", temporaryNibFilePath]).wait() === 1)
[CPException raise:ConverterConversionException reason:@"Could not compile file: " + aFilePath];
if (OS.popen(["/usr/bin/ibtool", aFilePath, "--compile", temporaryNibFilePath]).wait() === 1)
[CPException raise:ConverterConversionException reason:@"Could not compile file: " + aFilePath];
}
else
{
temporaryNibFilePath = aFilePath;
}
// Convert from binary plist to XML plist
var temporaryPlistFilePath = FILE.join("/tmp", FILE.basename(aFilePath) + ".tmp.plist");