In Xcode 3, applications were archived in .apparchive folders.
In Xcode 4, applications are now archived in an .xcarchive bundle.
Is there a way to convert .apparchive folders in .xcarchive bundles or to open .apparchive folders with Xcode 4?
Dave Dunkin's script worked great, but I missed the icon and version in some cases. Below a slightly adjusted version of the script. You need to install MacRuby, available here: http://www.macruby.org/downloads.html.
#!/System/Library/PrivateFrameworks/MacRuby.framework/Versions/A/usr/bin/macruby
framework 'Cocoa'
require 'date'
require 'fileutils'
Dir.glob(Dir.home() + '/Library/Application Support/Developer/Shared/Archived Applications/*.apparchive').each { |apparchivePath|
print "Found archive at #{apparchivePath}... "
archiveInfo = NSDictionary.dictionaryWithContentsOfURL(NSURL.fileURLWithPath(apparchivePath + '/ArchiveInfo.plist'))
name = archiveInfo['XCUserProvidedName'] || archiveInfo['XCApplicationName']
appFilename = archiveInfo['XCApplicationFilename']
appPath = 'Applications/' + appFilename
archiveDate = archiveInfo['XCArchivedDate']
xcarchivePath = Dir.home() + '/Library/Developer/Xcode/Archives/' + archiveDate.strftime('%Y-%m-%d') + '/' + name + ' ' + archiveDate.strftime('%m-%d-%y %I.%M %p') + '.xcarchive'
appVersion = archiveInfo['CFBundleVersion']
iconPaths = archiveInfo['XCInfoPlist']['CFBundleIconFiles']
if not iconPaths
iconPaths = appPath + '/' + archiveInfo['XCInfoPlist']['CFBundleIconFile']
else
iconPaths = archiveInfo['XCInfoPlist']['CFBundleIconFiles'].collect { |f| appPath + '/' + f }
end
if File.directory?(xcarchivePath)
puts 'skipping'
else
puts 'importing'
FileUtils.mkdir_p(xcarchivePath)
xcarchiveInfo = {
'ApplicationProperties' => {
'ApplicationPath' => appPath,
'CFBundleIdentifier' => archiveInfo['CFBundleIdentifier'],
'CFBundleShortVersionString' => appVersion,
'IconPaths' => iconPaths
},
'ArchiveVersion' => 1,
'CreationDate' => archiveDate,
'Name' => name,
'SchemeName' => archiveInfo['XCApplicationName']
}
if archiveInfo.has_key?('XCUserProvidedComment')
xcarchiveInfo['Comment'] = archiveInfo['XCUserProvidedComment']
end
xcarchiveInfo.writeToURL(NSURL.fileURLWithPath(xcarchivePath + '/Info.plist'), atomically:false)
FileUtils.mkdir_p(xcarchivePath + '/Products/Applications')
FileUtils.cp_r(apparchivePath + '/' + appFilename, xcarchivePath + '/Products/Applications')
FileUtils.mkdir_p(xcarchivePath + '/dSYMs')
FileUtils.cp_r(apparchivePath + '/' + appFilename + '.dSYM', xcarchivePath + '/dSYMs')
end
}
Here's a MacRuby script I wrote to do this for me.
#!/usr/local/bin/macruby
framework 'Cocoa'
require 'date'
require 'fileutils'
Dir.glob(Dir.home() + '/Library/Application Support/Developer/Shared/Archived Applications/*.apparchive').each { |apparchivePath|
print "Found archive at #{apparchivePath}... "
archiveInfo = NSDictionary.dictionaryWithContentsOfURL(NSURL.fileURLWithPath(apparchivePath + '/ArchiveInfo.plist'))
name = archiveInfo['XCUserProvidedName'] || archiveInfo['XCApplicationName']
appFilename = archiveInfo['XCApplicationFilename']
appPath = 'Applications/' + appFilename
archiveDate = archiveInfo['XCArchivedDate']
xcarchivePath = Dir.home() + '/Library/Developer/Xcode/Archives/' + archiveDate.strftime('%Y-%m-%d') + '/' + name + ' ' + archiveDate.strftime('%m-%d-%y %I.%M %p') + '.xcarchive'
if File.directory?(xcarchivePath)
puts 'skipping'
else
puts 'importing'
FileUtils.mkdir_p(xcarchivePath)
xcarchiveInfo = {
'ApplicationProperties' => {
'ApplicationPath' => appPath,
'CFBundleIdentifier' => archiveInfo['CFBundleIdentifier'],
'IconPaths' => archiveInfo['XCInfoPlist']['CFBundleIconFiles'].collect { |f| appPath + '/' + f }
},
'ArchiveVersion' => 1,
'CreationDate' => archiveDate,
'Name' => name,
'SchemeName' => archiveInfo['XCApplicationName']
}
if archiveInfo.has_key?('XCUserProvidedComment')
xcarchiveInfo['Comment'] = archiveInfo['XCUserProvidedComment']
end
xcarchiveInfo.writeToURL(NSURL.fileURLWithPath(xcarchivePath + '/Info.plist'), atomically:false)
FileUtils.mkdir_p(xcarchivePath + '/Products/Applications')
FileUtils.cp_r(apparchivePath + '/' + appFilename, xcarchivePath + '/Products/Applications')
FileUtils.mkdir_p(xcarchivePath + '/dSYMs')
FileUtils.cp_r(apparchivePath + '/' + appFilename + '.dSYM', xcarchivePath + '/dSYMs')
end
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With