mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-22 04:30:47 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
07a6893e1f | ||
|
|
4b119a1eed | ||
|
|
c2c94bdb1f | ||
|
|
d14e89ef53 | ||
|
|
7bd4e56cd5 | ||
|
|
8577ed8953 | ||
|
|
7b8fd7c097 | ||
|
|
cb15481e88 | ||
|
|
efa8447b1f | ||
|
|
e140353ed5 | ||
|
|
d6316b6d9c | ||
|
|
b0c9c31dc1 | ||
|
|
9d03d79ca7 | ||
|
|
519dccf64b | ||
|
|
1392f5155a | ||
|
|
76ce31f2f6 | ||
|
|
f46d7b5c1e | ||
|
|
d94c316583 | ||
|
|
c97a0462ae | ||
|
|
a62db7348d | ||
|
|
bd77daac35 | ||
|
|
b41165e2e2 | ||
|
|
49c622b36b | ||
|
|
2d33235886 | ||
|
|
2aa4899efd | ||
|
|
a0f368823b | ||
|
|
afec652729 | ||
|
|
0ae81e3c05 | ||
|
|
90d319cb02 | ||
|
|
4ffb2d2361 | ||
|
|
e8508a4a66 | ||
|
|
a5b92c2008 | ||
|
|
d7185de470 | ||
|
|
0c1eca9f82 | ||
|
|
88de072950 | ||
|
|
5efef76004 | ||
|
|
95eb6456e3 | ||
|
|
4cbffd02e3 | ||
|
|
47a4978e6a | ||
|
|
0400bc4d66 | ||
|
|
e1ef953067 | ||
|
|
bfa28948f0 | ||
|
|
409b35c20f | ||
|
|
aa92d572dd | ||
|
|
f1d3e4dd7f | ||
|
|
8a45304d55 | ||
|
|
f56a6025a0 | ||
|
|
805447d748 | ||
|
|
cdfd506cc0 | ||
|
|
90098dae5a | ||
|
|
3148182f1b | ||
|
|
31172f61f9 | ||
|
|
d35a68f5be | ||
|
|
6745346f1d | ||
|
|
1ab5de851f | ||
|
|
358933f965 | ||
|
|
a60255c95c | ||
|
|
2c54ec012d | ||
|
|
b671c6bef6 | ||
|
|
6f24f56f0d | ||
|
|
59f9e0ee1b | ||
|
|
ac7fd917d3 | ||
|
|
53f0f4f9ee | ||
|
|
55c57abd2f | ||
|
|
006e71fa89 | ||
|
|
c6d47ed68d | ||
|
|
fd906d9589 | ||
|
|
3e6431f94d | ||
|
|
4a015ada8f | ||
|
|
2c1b3783e4 | ||
|
|
808bde2699 | ||
|
|
fde6b4775e | ||
|
|
92bafa92bf | ||
|
|
7e2d4b019e | ||
|
|
10b8872afb | ||
|
|
d4d984f42c | ||
|
|
bd98b33e25 | ||
|
|
79f447d537 | ||
|
|
a4759c871e | ||
|
|
a3b9a74fe1 | ||
|
|
faba759574 | ||
|
|
91800e3036 | ||
|
|
d7dbbe4bb9 | ||
|
|
2579f2c3a3 | ||
|
|
01e9bd82be | ||
|
|
d34d2853f6 | ||
|
|
fd1ffce3e2 | ||
|
|
6ae7b68659 | ||
|
|
54dc6d0071 | ||
|
|
a773ac5856 | ||
|
|
686c87242c | ||
|
|
f2eaaeb4a3 | ||
|
|
5676acaebc | ||
|
|
0055adcc52 | ||
|
|
ad518eb209 | ||
|
|
20100c283f | ||
|
|
fc88f94d5d | ||
|
|
222ab3edd9 | ||
|
|
4b831a1394 | ||
|
|
bdc45d7e47 | ||
|
|
6ca5c3a337 | ||
|
|
4ab8fd1010 | ||
|
|
3f40f444db | ||
|
|
f1d5103a07 | ||
|
|
890f1fb393 | ||
|
|
d7993257fe | ||
|
|
c99378c170 | ||
|
|
00d8b64b41 | ||
|
|
6a79789d32 | ||
|
|
ec8f46af91 | ||
|
|
2ae8248c35 | ||
|
|
d9d3ff2a8e | ||
|
|
b420ad65be | ||
|
|
5504d6896f | ||
|
|
d888705fd8 | ||
|
|
8d1109b59f | ||
|
|
25aca9f56f | ||
|
|
e75a9b0591 | ||
|
|
5dfc6ab3b2 | ||
|
|
76cca58776 | ||
|
|
7141818b31 | ||
|
|
52bee98867 | ||
|
|
b262c2b581 | ||
|
|
192c3b4c2d | ||
|
|
cfe375b5f3 | ||
|
|
271970697e | ||
|
|
1539c0c077 | ||
|
|
aa25194536 | ||
|
|
6ab4163957 | ||
|
|
dfa27acde2 | ||
|
|
50c3df3a6f | ||
|
|
31a49c83b5 | ||
|
|
a57eb736cb | ||
|
|
52b2d75d63 | ||
|
|
9ea81e21b9 | ||
|
|
eda214a3ec | ||
|
|
d2b7fd6236 | ||
|
|
77ce7c19e9 | ||
|
|
048ce10ed5 | ||
|
|
b23d4a9641 | ||
|
|
843bbe7ece | ||
|
|
a7dbe4184c | ||
|
|
3287299f53 | ||
|
|
1b71d3ebd1 | ||
|
|
ef8edef094 | ||
|
|
c793adf2ed | ||
|
|
5cf229ba41 | ||
|
|
4789ebdec5 | ||
|
|
1325d3fe40 | ||
|
|
8d2054e62a | ||
|
|
93ebf843c2 | ||
|
|
984aac852f | ||
|
|
478c7fd8cd | ||
|
|
08065bc05b | ||
|
|
4eebdb82c4 | ||
|
|
066d634ef6 | ||
|
|
9e2e489109 | ||
|
|
f9c428ee06 | ||
|
|
595c6ce491 | ||
|
|
12904a5af6 | ||
|
|
7fc9e32ce7 | ||
|
|
409e7e22bf | ||
|
|
ed456740b0 | ||
|
|
cdfcd1469e | ||
|
|
4c54349c23 | ||
|
|
833081ffa9 | ||
|
|
faed494d4e | ||
|
|
dbebe4b3b2 | ||
|
|
320b3aa62a | ||
|
|
1d8adc8fac | ||
|
|
bc458a6ab5 | ||
|
|
e6deed9c56 | ||
|
|
6a48420e07 | ||
|
|
59f9236009 | ||
|
|
716bb30e7c | ||
|
|
02e090c291 | ||
|
|
f6a2e76685 | ||
|
|
8f5b9f03ac | ||
|
|
bb682da743 | ||
|
|
bf38b0c9fd | ||
|
|
e64516c089 | ||
|
|
b515c15f9b | ||
|
|
0bd27c0cb7 | ||
|
|
abda56d047 | ||
|
|
96272fce7d | ||
|
|
dc925712dc | ||
|
|
5fe0a7cb59 | ||
|
|
315cbaab1b | ||
|
|
c747ffc35b |
No files matched your search
@@ -16,3 +16,4 @@ profile
|
||||
|
||||
## Ignore incredibly annoying .DS_Store files
|
||||
.DS_Store
|
||||
DerivedData/
|
||||
@@ -0,0 +1,47 @@
|
||||
# 1.7.0
|
||||
|
||||
* Dropped support for Mac OS X 10.6. Sparkle now supports 10.7 and newer (including 10.10 Yosemite) on 64-bit Intel Macs (the last 32-bit Mac was released in 2006).
|
||||
* Removed use of deprecated functions (Zachary Waldowski)
|
||||
* Switched to modern Obj-C runtime and new literals syntax
|
||||
* Removed pre-10.7 code. (C.W. Betts)
|
||||
* Use more Blocks/libdispatch code. (C.W. Betts)
|
||||
* Cleaned up and improved security of `generate_keys`/`sign_update` scripts
|
||||
|
||||
# 1.6.1
|
||||
|
||||
* Removed archive password prompt (Kornel Lesiński)
|
||||
* (Re)fixes bug where URLs are naively double escaped (Andrew Madsen)
|
||||
* Fixed typo that caused crashes in BinaryDelta (Tamas Lustyik)
|
||||
* SUStandardVersionComparator.h is public (Vincent CARLIER)
|
||||
* Remove pre-10.6-specific code. (C.W. Betts)
|
||||
* Objective C 2 getters and setters. (C.W. Betts)
|
||||
* Define correct dependencies on locale scripts (Antonin Hildebrand)
|
||||
|
||||
# 1.6.0
|
||||
|
||||
* Cleaned up and deleted redundant strings files (Kornel Lesiński)
|
||||
* Modern Objective C syntax, properties where possible. (C.W. Betts)
|
||||
* Make SUAppcastDelegate a formal protocol. (C.W. Betts)
|
||||
* Fixed default font in release notes WebView (Kornel Lesiński)
|
||||
* Configurable name for finish_installation.app (Kornel Lesiński)
|
||||
* Removed code for 10.4 (Kornel Lesiński)
|
||||
* Convert all strings files to UTF-8 (UTF-16 must die) (Kornel Lesiński)
|
||||
* Removing GC target (Matt Thomas)
|
||||
* finish_installation.app and pkg files will not removed when we use *.pkg installer and restart system in the installer (Takayama Fumihiko)
|
||||
* Select Korean and Slovak for Sparkle.strings localization (Shon Frazier)
|
||||
* Updated the Romanian translation (Gabe)
|
||||
* pt-BR localization polishing (BR Lingo)
|
||||
* update zh_CN (61)
|
||||
* Shut up some warnings & make build with newer Xcode (Uli Kusterer)
|
||||
* Less unsafety with format strings (Uli Kusterer)
|
||||
* New icon (Rick Fillion)
|
||||
* fixed a 'content rectangle not entirely onscreen' warning (Simone Manganelli)
|
||||
* updated sends system profile to use info.plist if user defaults key isn't present (Jamie Pinkham)
|
||||
* Support for notifications on some updater events (Doug Russell)
|
||||
* Allow the delegate to trigger a silent install and relaunch (Matt Stevens)
|
||||
* Support silent relaunches (Matt Stevens)
|
||||
* Increment the sudden termination counter if installing on quit (Matt Stevens)
|
||||
* Prompts the user to update after a week (rather than a day) if he doesn't quit the app (Andy Matuschak)
|
||||
* Adding <sparkle:tags> appcast item element, <sparkle:criticalUpdate /> tag (Andy Matuschak)
|
||||
* We have this check box that says "Automatically download and install updates in the future." But we only download them automatically. We still ask permission again before installing them. (Andy Matuschak)
|
||||
|
||||
@@ -2,7 +2,3 @@
|
||||
|
||||
PRODUCT_NAME = BinaryDelta
|
||||
GCC_PREFIX_HEADER =
|
||||
MACOSX_DEPLOYMENT_TARGET[arch=i386] = 10.5
|
||||
MACOSX_DEPLOYMENT_TARGET[arch=ppc64] = 10.5
|
||||
MACOSX_DEPLOYMENT_TARGET[arch=ppc] = 10.5
|
||||
MACOSX_DEPLOYMENT_TARGET[arch=x86_64] = 10.5
|
||||
@@ -2,4 +2,3 @@
|
||||
#include "ConfigCommonDebug.xcconfig"
|
||||
#include "ConfigBinaryDelta.xcconfig"
|
||||
|
||||
OTHER_CFLAGS = -DDEBUG
|
||||
@@ -1,51 +1,29 @@
|
||||
// Common
|
||||
|
||||
PREBINDING = NO
|
||||
ZERO_LINK = NO
|
||||
CURRENT_PROJECT_VERSION = 1.5
|
||||
SDKROOT = macosx10.7
|
||||
MACOSX_DEPLOYMENT_TARGET[arch=ppc] = 10.4
|
||||
MACOSX_DEPLOYMENT_TARGET[arch=ppc64] = 10.5
|
||||
MACOSX_DEPLOYMENT_TARGET[arch=i386] = 10.4
|
||||
MACOSX_DEPLOYMENT_TARGET[arch=x86_64] = 10.5
|
||||
GCC_C_LANGUAGE_STANDARD = c99
|
||||
GCC_ENABLE_OBJC_EXCEPTIONS = YES
|
||||
GCC_DEBUGGING_SYMBOLS = full
|
||||
FINISH_INSTALL_TOOL_NAME = Autoupdate
|
||||
|
||||
CURRENT_PROJECT_VERSION = 1.7.0
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES
|
||||
GCC_PREFIX_HEADER = $(SDKROOT)/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h
|
||||
GCC_FAST_OBJC_DISPATCH = YES
|
||||
GCC_ENABLE_PASCAL_STRINGS = NO
|
||||
ARCHS = ppc i386 x86_64
|
||||
GCC_VERSION = com.apple.compilers.llvm.clang.1_0
|
||||
CLANG_LINK_OBJC_RUNTIME = NO
|
||||
ARCHS = x86_64
|
||||
|
||||
GCC_PREPROCESSOR_DEFINITIONS = FINISH_INSTALL_TOOL_NAME=$(FINISH_INSTALL_TOOL_NAME)
|
||||
|
||||
// Enable warnings
|
||||
GCC_WARN_CHECK_SWITCH_STATEMENTS = YES
|
||||
GCC_WARN_EFFECTIVE_CPLUSPLUS_VIOLATIONS = YES
|
||||
GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES
|
||||
GCC_WARN_SHADOW = YES
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES
|
||||
GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = YES
|
||||
GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES
|
||||
GCC_WARN_MISSING_PARENTHESES = YES
|
||||
GCC_WARN_ABOUT_MISSING_NEWLINE = YES
|
||||
GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES
|
||||
GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES
|
||||
GCC_WARN_ABOUT_POINTER_SIGNEDNESS = YES
|
||||
GCC_WARN_SIGN_COMPARE = YES
|
||||
GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = YES
|
||||
GCC_WARN_UNKNOWN_PRAGMAS = YES
|
||||
GCC_WARN_UNUSED_VARIABLE = YES
|
||||
GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = YES
|
||||
GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO = YES
|
||||
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES
|
||||
GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES
|
||||
GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO = YES
|
||||
GCC_WARN_UNUSED_FUNCTION = YES
|
||||
GCC_WARN_UNUSED_LABEL = YES
|
||||
GCC_WARN_UNUSED_VALUE = YES
|
||||
GCC_WARN_UNUSED_PARAMETER = YES
|
||||
GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES
|
||||
WARNING_CFLAGS = -Wall -Wno-unused-parameter -Werror -Wundef -Wendif-labels -Wpointer-arith -Wcast-align -Wwrite-strings -Wmissing-format-attribute -Wpacked -Wredundant-decls -Winline -Wdisabled-optimization -Winvalid-pch
|
||||
@@ -3,8 +3,6 @@
|
||||
GCC_OPTIMIZATION_LEVEL = 0
|
||||
DEBUG_INFORMATION_FORMAT = dwarf
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = YES
|
||||
SPARKLE_EXTRA_DEBUG_10_5_ONLY = -fstack-protector -D_FORTIFY_SOURCE=2
|
||||
SPARKLE_EXTRA_DEBUG = -DDEBUG
|
||||
OTHER_CFLAGS = $(SPARKLE_EXTRA_DEBUG)
|
||||
|
||||
// Add $(SPARKLE_EXTRA_DEBUG_10_5_ONLY) to SPARKLE_EXTRA_DEBUG if your deployment is 10.5 or greater.
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
GCC_OPTIMIZATION_LEVEL = s
|
||||
DEBUG_INFORMATION_FORMAT = dwarf-with-dsym
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = NO
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = YES
|
||||
DEAD_CODE_STRIPPING = YES
|
||||
GCC_TREAT_WARNINGS_AS_ERRORS = YES
|
||||
GCC_TREAT_WARNINGS_AS_ERRORS = NO
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES
|
||||
@@ -1,8 +1,8 @@
|
||||
// Framework only
|
||||
|
||||
INSTALL_PATH = @loader_path/../Frameworks
|
||||
DYLIB_COMPATIBILITY_VERSION = 1.5
|
||||
DYLIB_CURRENT_VERSION = 1.5
|
||||
DYLIB_COMPATIBILITY_VERSION = 1.6
|
||||
DYLIB_CURRENT_VERSION = 1.7
|
||||
PRODUCT_NAME = Sparkle
|
||||
WRAPPER_EXTENSION = framework
|
||||
FRAMEWORK_VERSION = A
|
||||
|
||||
@@ -2,4 +2,3 @@
|
||||
#include "ConfigCommonDebug.xcconfig"
|
||||
#include "ConfigFramework.xcconfig"
|
||||
|
||||
OTHER_CFLAGS = -DDEBUG
|
||||
@@ -2,8 +2,3 @@
|
||||
#include "ConfigCommonRelease.xcconfig"
|
||||
#include "ConfigFramework.xcconfig"
|
||||
|
||||
STRIP_INSTALLED_PRODUCT = YES
|
||||
DEPLOYMENT_POSTPROCESSING = YES
|
||||
STRIPFLAGS = -u -r
|
||||
STRIP_STYLE = non-global
|
||||
SEPARATE_STRIP = YES
|
||||
@@ -1,3 +0,0 @@
|
||||
#include "ConfigFrameworkRelease.xcconfig"
|
||||
|
||||
GCC_ENABLE_OBJC_GC = supported
|
||||
@@ -1,4 +1,4 @@
|
||||
// Relaunch Tool only
|
||||
|
||||
PRODUCT_NAME = finish_installation
|
||||
PRODUCT_NAME = $(FINISH_INSTALL_TOOL_NAME)
|
||||
SKIP_INSTALL = YES
|
||||
@@ -1,5 +1,3 @@
|
||||
#include "ConfigCommon.xcconfig"
|
||||
#include "ConfigCommonDebug.xcconfig"
|
||||
#include "ConfigRelaunch.xcconfig"
|
||||
|
||||
OTHER_CFLAGS = -DDEBUG
|
||||
@@ -2,4 +2,3 @@
|
||||
#include "ConfigCommonDebug.xcconfig"
|
||||
#include "ConfigTestApp.xcconfig"
|
||||
|
||||
OTHER_CFLAGS = -DDEBUG
|
||||
@@ -1,3 +0,0 @@
|
||||
#include "ConfigTestAppRelease.xcconfig"
|
||||
|
||||
GCC_ENABLE_OBJC_GC = required
|
||||
@@ -1,10 +1,9 @@
|
||||
// Unit Test only
|
||||
|
||||
INFOPLIST_FILE = Tests/Sparkle Unit Tests-Info.plist
|
||||
OTHER_LDFLAGS = -framework Cocoa -framework SenTestingKit
|
||||
OTHER_LDFLAGS = -framework Cocoa -framework XCTest
|
||||
PRODUCT_NAME = Sparkle Unit Tests
|
||||
WRAPPER_EXTENSION = octest
|
||||
WRAPPER_EXTENSION = xctest
|
||||
FRAMEWORK_SEARCH_PATHS = $(DEVELOPER_LIBRARY_DIR)/Frameworks
|
||||
GCC_PREFIX_HEADER = $(SYSTEM_LIBRARY_DIR)/Frameworks/Cocoa.framework/Headers/Cocoa.h
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.6
|
||||
@@ -1,3 +0,0 @@
|
||||
#include "ConfigUnitTestRelease.xcconfig"
|
||||
|
||||
GCC_ENABLE_OBJC_GC = required
|
||||
+5
-5
@@ -6,22 +6,22 @@
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>${PRODUCT_NAME}</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string></string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>org.andymatuschak.Sparkle</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>${PRODUCT_NAME}</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>${CURRENT_PROJECT_VERSION} git</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.5</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.5 Beta (git)</string>
|
||||
<string>${CURRENT_PROJECT_VERSION}</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
|
||||
+2
-12
@@ -10,16 +10,8 @@
|
||||
#define NTSYNCHRONOUSTASK_H
|
||||
|
||||
@interface NTSynchronousTask : NSObject
|
||||
{
|
||||
@private
|
||||
NSTask *mv_task;
|
||||
NSPipe *mv_outputPipe;
|
||||
NSPipe *mv_inputPipe;
|
||||
|
||||
NSData* mv_output;
|
||||
BOOL mv_done;
|
||||
int mv_result;
|
||||
}
|
||||
@property (readonly, retain) NSData *output;
|
||||
@property (readonly) int result;
|
||||
|
||||
// pass nil for directory if not needed
|
||||
// returns the result
|
||||
@@ -28,8 +20,6 @@
|
||||
+(NSData*)task:(NSString*)toolPath directory:(NSString*)currentDirectory withArgs:(NSArray*)args input:(NSData*)input;
|
||||
|
||||
- (void)run:(NSString*)toolPath directory:(NSString*)currentDirectory withArgs:(NSArray*)args input:(NSData*)input;
|
||||
- (int)result;
|
||||
- (NSData *)output;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
+78
-155
@@ -13,122 +13,47 @@
|
||||
#import "SUVersionComparisonProtocol.h"
|
||||
#import "NTSynchronousTask.h"
|
||||
|
||||
@interface NTSynchronousTask ()
|
||||
@property (retain) NSTask *task;
|
||||
@property (retain) NSPipe *outputPipe;
|
||||
@property (retain) NSPipe *inputPipe;
|
||||
@property (readwrite, retain) NSData *output;
|
||||
@property (getter = isDone) BOOL done;
|
||||
@property (readwrite) int result;
|
||||
@end
|
||||
|
||||
@implementation NTSynchronousTask
|
||||
|
||||
//----------------------------------------------------------
|
||||
// task
|
||||
//----------------------------------------------------------
|
||||
- (NSTask *)task
|
||||
{
|
||||
return mv_task;
|
||||
}
|
||||
|
||||
- (void)setTask:(NSTask *)theTask
|
||||
{
|
||||
if (mv_task != theTask) {
|
||||
[mv_task release];
|
||||
mv_task = [theTask retain];
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------
|
||||
// outputPipe
|
||||
//----------------------------------------------------------
|
||||
- (NSPipe *)outputPipe
|
||||
{
|
||||
return mv_outputPipe;
|
||||
}
|
||||
|
||||
- (void)setOutputPipe:(NSPipe *)theOutputPipe
|
||||
{
|
||||
if (mv_outputPipe != theOutputPipe) {
|
||||
[mv_outputPipe release];
|
||||
mv_outputPipe = [theOutputPipe retain];
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------
|
||||
// inputPipe
|
||||
//----------------------------------------------------------
|
||||
- (NSPipe *)inputPipe
|
||||
{
|
||||
return mv_inputPipe;
|
||||
}
|
||||
|
||||
- (void)setInputPipe:(NSPipe *)theInputPipe
|
||||
{
|
||||
if (mv_inputPipe != theInputPipe) {
|
||||
[mv_inputPipe release];
|
||||
mv_inputPipe = [theInputPipe retain];
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------
|
||||
// output
|
||||
//----------------------------------------------------------
|
||||
- (NSData *)output
|
||||
{
|
||||
return mv_output;
|
||||
}
|
||||
|
||||
- (void)setOutput:(NSData *)theOutput
|
||||
{
|
||||
if (mv_output != theOutput) {
|
||||
[mv_output release];
|
||||
mv_output = [theOutput retain];
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------
|
||||
// done
|
||||
//----------------------------------------------------------
|
||||
- (BOOL)done
|
||||
{
|
||||
return mv_done;
|
||||
}
|
||||
|
||||
- (void)setDone:(BOOL)flag
|
||||
{
|
||||
mv_done = flag;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------
|
||||
// result
|
||||
//----------------------------------------------------------
|
||||
- (int)result
|
||||
{
|
||||
return mv_result;
|
||||
}
|
||||
|
||||
- (void)setResult:(int)theResult
|
||||
{
|
||||
mv_result = theResult;
|
||||
}
|
||||
@synthesize output = mv_output;
|
||||
@synthesize result = mv_result;
|
||||
@synthesize task = mv_task;
|
||||
@synthesize outputPipe = mv_outputPipe;
|
||||
@synthesize inputPipe = mv_inputPipe;
|
||||
@synthesize done = mv_done;
|
||||
|
||||
- (void)taskOutputAvailable:(NSNotification*)note
|
||||
{
|
||||
[self setOutput:[[note userInfo] objectForKey:NSFileHandleNotificationDataItem]];
|
||||
self.output = [note userInfo][NSFileHandleNotificationDataItem];
|
||||
|
||||
[self setDone:YES];
|
||||
self.done = YES;
|
||||
}
|
||||
|
||||
- (void)taskDidTerminate:(NSNotification*)note
|
||||
{
|
||||
[self setResult:[[self task] terminationStatus]];
|
||||
self.result = [self.task terminationStatus];
|
||||
}
|
||||
|
||||
- (id)init;
|
||||
- (instancetype)init;
|
||||
{
|
||||
self = [super init];
|
||||
if (self)
|
||||
{
|
||||
[self setTask:[[[NSTask alloc] init] autorelease]];
|
||||
[self setOutputPipe:[[[NSPipe alloc] init] autorelease]];
|
||||
[self setInputPipe:[[[NSPipe alloc] init] autorelease]];
|
||||
self.task = [[[NSTask alloc] init] autorelease];
|
||||
self.outputPipe = [[[NSPipe alloc] init] autorelease];
|
||||
self.inputPipe = [[[NSPipe alloc] init] autorelease];
|
||||
|
||||
[[self task] setStandardInput:[self inputPipe]];
|
||||
[[self task] setStandardOutput:[self outputPipe]];
|
||||
[[self task] setStandardError:[self outputPipe]];
|
||||
self.task.standardInput = self.inputPipe;
|
||||
self.task.standardOutput = self.outputPipe;
|
||||
self.task.standardError = self.outputPipe;
|
||||
}
|
||||
|
||||
return self;
|
||||
@@ -141,10 +66,10 @@
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
|
||||
[mv_task release];
|
||||
[mv_outputPipe release];
|
||||
[mv_inputPipe release];
|
||||
[mv_output release];
|
||||
self.task = nil;
|
||||
self.outputPipe = nil;
|
||||
self.inputPipe = nil;
|
||||
self.output = nil;
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
@@ -153,11 +78,12 @@
|
||||
{
|
||||
BOOL success = NO;
|
||||
|
||||
if (currentDirectory)
|
||||
[[self task] setCurrentDirectoryPath: currentDirectory];
|
||||
if (currentDirectory) {
|
||||
self.task.currentDirectoryPath = currentDirectory;
|
||||
}
|
||||
|
||||
[[self task] setLaunchPath:toolPath];
|
||||
[[self task] setArguments:args];
|
||||
self.task.launchPath = toolPath;
|
||||
self.task.arguments = args;
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(taskOutputAvailable:)
|
||||
@@ -169,11 +95,11 @@
|
||||
name:NSTaskDidTerminateNotification
|
||||
object:[self task]];
|
||||
|
||||
[[[self outputPipe] fileHandleForReading] readToEndOfFileInBackgroundAndNotifyForModes:[NSArray arrayWithObjects:NSDefaultRunLoopMode, NSModalPanelRunLoopMode, NSEventTrackingRunLoopMode, nil]];
|
||||
[[[self outputPipe] fileHandleForReading] readToEndOfFileInBackgroundAndNotifyForModes:@[NSDefaultRunLoopMode, NSModalPanelRunLoopMode, NSEventTrackingRunLoopMode]];
|
||||
|
||||
@try
|
||||
{
|
||||
[[self task] launch];
|
||||
[self.task launch];
|
||||
success = YES;
|
||||
}
|
||||
@catch (NSException *localException) { }
|
||||
@@ -183,12 +109,12 @@
|
||||
if (input)
|
||||
{
|
||||
// feed the running task our input
|
||||
[[[self inputPipe] fileHandleForWriting] writeData:input];
|
||||
[[[self inputPipe] fileHandleForWriting] closeFile];
|
||||
[[self.inputPipe fileHandleForWriting] writeData:input];
|
||||
[[self.inputPipe fileHandleForWriting] closeFile];
|
||||
}
|
||||
|
||||
// loop until we are done receiving the data
|
||||
if (![self done])
|
||||
if (!self.done)
|
||||
{
|
||||
double resolution = 1;
|
||||
BOOL isRunning;
|
||||
@@ -199,68 +125,65 @@
|
||||
|
||||
isRunning = [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode
|
||||
beforeDate:next];
|
||||
} while (isRunning && ![self done]);
|
||||
} while (isRunning && !self.done);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+ (NSData*)task:(NSString*)toolPath directory:(NSString*)currentDirectory withArgs:(NSArray*)args input:(NSData*)input
|
||||
{
|
||||
NSData* result = nil;
|
||||
// we need this wacky pool here, otherwise we run out of pipes, the pipes are internally autoreleased
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
NSData* result=nil;
|
||||
|
||||
@try
|
||||
{
|
||||
NTSynchronousTask* task = [[NTSynchronousTask alloc] init];
|
||||
@autoreleasepool {
|
||||
@try {
|
||||
NTSynchronousTask* task = [[NTSynchronousTask alloc] init];
|
||||
|
||||
[task run:toolPath directory:currentDirectory withArgs:args input:input];
|
||||
|
||||
if ([task result] == 0) {
|
||||
result = [[task output] retain];
|
||||
}
|
||||
|
||||
[task release];
|
||||
}
|
||||
@catch (NSException *localException) { }
|
||||
|
||||
[task run:toolPath directory:currentDirectory withArgs:args input:input];
|
||||
|
||||
if ([task result] == 0)
|
||||
result = [[task output] retain];
|
||||
|
||||
[task release];
|
||||
}
|
||||
@catch (NSException *localException) { }
|
||||
|
||||
[pool drain];
|
||||
}
|
||||
|
||||
// retained above
|
||||
[result autorelease];
|
||||
|
||||
return result;
|
||||
return [result autorelease];
|
||||
}
|
||||
|
||||
|
||||
+(int) task:(NSString*)toolPath directory:(NSString*)currentDirectory withArgs:(NSArray*)args input:(NSData*)input output: (NSData**)outData
|
||||
{
|
||||
int taskResult = 0;
|
||||
// we need this wacky pool here, otherwise we run out of pipes, the pipes are internally autoreleased
|
||||
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
|
||||
int taskResult = 0;
|
||||
if( outData )
|
||||
*outData = nil;
|
||||
|
||||
NS_DURING
|
||||
{
|
||||
NTSynchronousTask* task = [[NTSynchronousTask alloc] init];
|
||||
@autoreleasepool {
|
||||
if (outData) {
|
||||
*outData = nil;
|
||||
}
|
||||
|
||||
[task run:toolPath directory:currentDirectory withArgs:args input:input];
|
||||
@try {
|
||||
NTSynchronousTask* task = [[NTSynchronousTask alloc] init];
|
||||
|
||||
[task run:toolPath directory:currentDirectory withArgs:args input:input];
|
||||
|
||||
taskResult = [task result];
|
||||
if (outData) {
|
||||
*outData = [[task output] retain];
|
||||
}
|
||||
|
||||
[task release];
|
||||
} @catch (NSException *localException) {
|
||||
taskResult = errCppGeneral;
|
||||
}
|
||||
|
||||
taskResult = [task result];
|
||||
if( outData )
|
||||
*outData = [[task output] retain];
|
||||
|
||||
[task release];
|
||||
}
|
||||
NS_HANDLER;
|
||||
taskResult = errCppGeneral;
|
||||
NS_ENDHANDLER;
|
||||
|
||||
[pool drain];
|
||||
|
||||
}
|
||||
// retained above
|
||||
if( outData )
|
||||
if (outData) {
|
||||
[*outData autorelease];
|
||||
}
|
||||
|
||||
return taskResult;
|
||||
}
|
||||
|
||||
+12
-22
@@ -1,40 +1,30 @@
|
||||
# Sparkle
|
||||
# Sparkle <img src="Sparkle.png" width=48 height=48 alt="">
|
||||
is an easy-to-use software update framework for Cocoa developers.
|
||||
|
||||
* True self-updating--no work required from the user.
|
||||
## This fork
|
||||
|
||||
* Up to date with 10.9 SDK and Xcode 5/6. Supports Mac OS X 10.7+.
|
||||
* Merged bugfixes, security fixes and some features from multiple Sparkle forks.
|
||||
* Merged official Sparkle branch with truly automatic background updates (no UI at all) when user agreed to "Automatically download and install updates in the future."
|
||||
* Ability to mark updates as critical.
|
||||
* Progress and status notifications for the host app.
|
||||
* Name of finish_installation.app can be configured to match your app's name.
|
||||
|
||||
## Features
|
||||
|
||||
* True self-updating—no work required from the user.
|
||||
* Displays release notes to the user via WebKit.
|
||||
|
||||
* Displays a detailed progress window to the user.
|
||||
|
||||
* Supports authentication for installing in secure locations.
|
||||
|
||||
* Really, really easy to install.
|
||||
|
||||
* Uses appcasts for release information.
|
||||
|
||||
* The user can choose to automatically download and install all updates.
|
||||
|
||||
* Seamless integration—there's no mention of Sparkle; your icons and app name are used.
|
||||
|
||||
* Supports DSA signatures for ultra-secure updates.
|
||||
|
||||
* Sparkle requires no code in your app, so it's trivial to upgrade or remove the module.
|
||||
|
||||
## New in Sparkle 1.5:
|
||||
|
||||
* Optionally sends user demographic information to the server when checking for updates.
|
||||
|
||||
* Dual-mode garbage collection support for any memory management style.
|
||||
|
||||
* Sparkle doesn't bug the user until second launch for better first impressions.
|
||||
|
||||
* Sparkle can install .pkg files for more complicated products.
|
||||
|
||||
* Supports bundles, preference panes, plugins, and other non-.app software.
|
||||
|
||||
* Supports branches due to minimum OS version requirements.
|
||||
|
||||
* Deep delegate support to make Sparkle work exactly as you need.
|
||||
|
||||
* Tons of other stuff! [Read more about what's new.](http://andymatuschak.org/articles/2008/05/31/sparkle-15b1-now-available/ "Sparkle 1.5b1: now available!")
|
||||
+8
-7
@@ -9,26 +9,27 @@
|
||||
#ifndef SUAPPCAST_H
|
||||
#define SUAPPCAST_H
|
||||
|
||||
@protocol SUAppcastDelegate;
|
||||
|
||||
@class SUAppcastItem;
|
||||
@interface SUAppcast : NSObject
|
||||
@interface SUAppcast : NSObject<NSURLDownloadDelegate>
|
||||
{
|
||||
@private
|
||||
NSArray *items;
|
||||
NSString *userAgentString;
|
||||
id delegate;
|
||||
id<SUAppcastDelegate> delegate;
|
||||
NSString *downloadFilename;
|
||||
NSURLDownload *download;
|
||||
}
|
||||
@property (assign) id<SUAppcastDelegate> delegate;
|
||||
@property (copy) NSString *userAgentString;
|
||||
|
||||
- (void)fetchAppcastFromURL:(NSURL *)url;
|
||||
- (void)setDelegate:delegate;
|
||||
- (void)setUserAgentString:(NSString *)userAgentString;
|
||||
|
||||
- (NSArray *)items;
|
||||
|
||||
@property (readonly, copy) NSArray *items;
|
||||
@end
|
||||
|
||||
@interface NSObject (SUAppcastDelegate)
|
||||
@protocol SUAppcastDelegate <NSObject>
|
||||
- (void)appcastDidFinishLoading:(SUAppcast *)appcast;
|
||||
- (void)appcast:(SUAppcast *)appcast failedToLoadWithError:(NSError *)error;
|
||||
@end
|
||||
|
||||
+44
-77
@@ -16,55 +16,55 @@
|
||||
#import "SULog.h"
|
||||
|
||||
@interface NSXMLElement (SUAppcastExtensions)
|
||||
- (NSDictionary *)attributesAsDictionary;
|
||||
@property (readonly, copy) NSDictionary *attributesAsDictionary;
|
||||
@end
|
||||
|
||||
@implementation NSXMLElement (SUAppcastExtensions)
|
||||
- (NSDictionary *)attributesAsDictionary
|
||||
{
|
||||
NSEnumerator *attributeEnum = [[self attributes] objectEnumerator];
|
||||
NSXMLNode *attribute;
|
||||
NSMutableDictionary *dictionary = [NSMutableDictionary dictionary];
|
||||
|
||||
while ((attribute = [attributeEnum nextObject]))
|
||||
[dictionary setObject:[attribute stringValue] forKey:[attribute name]];
|
||||
for (NSXMLNode *attribute in attributeEnum) {
|
||||
dictionary[[attribute name]] = [attribute stringValue];
|
||||
}
|
||||
return dictionary;
|
||||
}
|
||||
@end
|
||||
|
||||
@interface SUAppcast () <NSURLDownloadDelegate>
|
||||
@property (copy) NSString *downloadFilename;
|
||||
@property (retain) NSURLDownload *download;
|
||||
@property (copy) NSArray *items;
|
||||
- (void)reportError:(NSError *)error;
|
||||
- (NSXMLNode *)bestNodeInNodes:(NSArray *)nodes;
|
||||
@end
|
||||
|
||||
@implementation SUAppcast
|
||||
@synthesize downloadFilename;
|
||||
@synthesize delegate;
|
||||
@synthesize userAgentString;
|
||||
@synthesize download;
|
||||
@synthesize items;
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[items release];
|
||||
items = nil;
|
||||
[userAgentString release];
|
||||
userAgentString = nil;
|
||||
[downloadFilename release];
|
||||
downloadFilename = nil;
|
||||
[download release];
|
||||
download = nil;
|
||||
self.items = nil;
|
||||
self.userAgentString = nil;
|
||||
self.downloadFilename = nil;
|
||||
self.download = nil;
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (NSArray *)items
|
||||
{
|
||||
return items;
|
||||
}
|
||||
|
||||
- (void)fetchAppcastFromURL:(NSURL *)url
|
||||
{
|
||||
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:30.0];
|
||||
if (userAgentString)
|
||||
if (userAgentString) {
|
||||
[request setValue:userAgentString forHTTPHeaderField:@"User-Agent"];
|
||||
}
|
||||
|
||||
download = [[NSURLDownload alloc] initWithRequest:request delegate:self];
|
||||
self.download = [[[NSURLDownload alloc] initWithRequest:request delegate:self] autorelease];
|
||||
}
|
||||
|
||||
- (void)download:(NSURLDownload *)aDownload decideDestinationWithSuggestedFilename:(NSString *)filename
|
||||
@@ -79,8 +79,7 @@
|
||||
|
||||
- (void)download:(NSURLDownload *)aDownload didCreateDestination:(NSString *)path
|
||||
{
|
||||
[downloadFilename release];
|
||||
downloadFilename = [path copy];
|
||||
self.downloadFilename = path;
|
||||
}
|
||||
|
||||
- (void)downloadDidFinish:(NSURLDownload *)aDownload
|
||||
@@ -95,22 +94,11 @@
|
||||
if (downloadFilename)
|
||||
{
|
||||
NSUInteger options = 0;
|
||||
if (NSAppKitVersionNumber < NSAppKitVersionNumber10_7) {
|
||||
// In order to avoid including external entities when parsing the appcast (a potential security vulnerability; see https://github.com/andymatuschak/Sparkle/issues/169), we ask NSXMLDocument to "tidy" the XML first. This happens to remove these external entities; it wouldn't be a future-proof approach, but it worked in these historical versions of OS X, and we have a more rigorous approach for 10.7+.
|
||||
options = NSXMLDocumentTidyXML;
|
||||
} else {
|
||||
// In 10.7 and later, there's a real option for the behavior we desire.
|
||||
options = NSXMLNodeLoadExternalEntitiesSameOriginOnly;
|
||||
}
|
||||
options = NSXMLNodeLoadExternalEntitiesSameOriginOnly;
|
||||
document = [[[NSXMLDocument alloc] initWithContentsOfURL:[NSURL fileURLWithPath:downloadFilename] options:options error:&error] autorelease];
|
||||
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4
|
||||
[[NSFileManager defaultManager] removeFileAtPath:downloadFilename handler:nil];
|
||||
#else
|
||||
[[NSFileManager defaultManager] removeItemAtPath:downloadFilename error:nil];
|
||||
#endif
|
||||
[downloadFilename release];
|
||||
downloadFilename = nil;
|
||||
self.downloadFilename = nil;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -149,11 +137,11 @@
|
||||
NSString *name = [node name];
|
||||
if (name)
|
||||
{
|
||||
NSMutableArray *nodes = [nodesDict objectForKey:name];
|
||||
NSMutableArray *nodes = nodesDict[name];
|
||||
if (nodes == nil)
|
||||
{
|
||||
nodes = [NSMutableArray array];
|
||||
[nodesDict setObject:nodes forKey:name];
|
||||
nodesDict[name] = nodes;
|
||||
}
|
||||
[nodes addObject:node];
|
||||
}
|
||||
@@ -161,16 +149,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
NSEnumerator *nameEnum = [nodesDict keyEnumerator];
|
||||
NSString *name;
|
||||
while ((name = [nameEnum nextObject]))
|
||||
for (NSString *name in nodesDict)
|
||||
{
|
||||
node = [self bestNodeInNodes:[nodesDict objectForKey:name]];
|
||||
node = [self bestNodeInNodes:nodesDict[name]];
|
||||
if ([name isEqualToString:@"enclosure"])
|
||||
{
|
||||
// enclosure is flattened as a separate dictionary for some reason
|
||||
NSDictionary *encDict = [(NSXMLElement *)node attributesAsDictionary];
|
||||
[dict setObject:encDict forKey:@"enclosure"];
|
||||
dict[@"enclosure"] = encDict;
|
||||
|
||||
}
|
||||
else if ([name isEqualToString:@"pubDate"])
|
||||
@@ -178,23 +164,25 @@
|
||||
// pubDate is expected to be an NSDate by SUAppcastItem, but the RSS class was returning an NSString
|
||||
NSDate *date = [NSDate dateWithNaturalLanguageString:[node stringValue]];
|
||||
if (date)
|
||||
[dict setObject:date forKey:name];
|
||||
dict[name] = date;
|
||||
}
|
||||
else if ([name isEqualToString:@"sparkle:deltas"])
|
||||
{
|
||||
NSMutableArray *deltas = [NSMutableArray array];
|
||||
NSEnumerator *childEnum = [[node children] objectEnumerator];
|
||||
NSXMLNode *child;
|
||||
while ((child = [childEnum nextObject])) {
|
||||
for (NSXMLNode *child in childEnum) {
|
||||
if ([[child name] isEqualToString:@"enclosure"])
|
||||
[deltas addObject:[(NSXMLElement *)child attributesAsDictionary]];
|
||||
}
|
||||
[dict setObject:deltas forKey:@"deltas"];
|
||||
dict[@"deltas"] = deltas;
|
||||
}
|
||||
else if (name != nil)
|
||||
{
|
||||
// add all other values as strings
|
||||
[dict setObject:[[node stringValue] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] forKey:name];
|
||||
NSString *theValue = [[node stringValue] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
|
||||
if (theValue != nil) {
|
||||
dict[name] = theValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,13 +204,13 @@
|
||||
if ([appcastItems count])
|
||||
{
|
||||
NSSortDescriptor *sort = [[[NSSortDescriptor alloc] initWithKey:@"date" ascending:NO] autorelease];
|
||||
[appcastItems sortUsingDescriptors:[NSArray arrayWithObject:sort]];
|
||||
items = [appcastItems copy];
|
||||
[appcastItems sortUsingDescriptors:@[sort]];
|
||||
self.items = appcastItems;
|
||||
}
|
||||
|
||||
if (failed)
|
||||
{
|
||||
[self reportError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUAppcastParseError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:SULocalizedString(@"An error occurred while parsing the update feed.", nil), NSLocalizedDescriptionKey, nil]]];
|
||||
[self reportError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUAppcastParseError userInfo:@{NSLocalizedDescriptionKey: SULocalizedString(@"An error occurred while parsing the update feed.", nil)}]];
|
||||
}
|
||||
else if ([delegate respondsToSelector:@selector(appcastDidFinishLoading:)])
|
||||
{
|
||||
@@ -234,14 +222,9 @@
|
||||
{
|
||||
if (downloadFilename)
|
||||
{
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4
|
||||
[[NSFileManager defaultManager] removeFileAtPath:downloadFilename handler:nil];
|
||||
#else
|
||||
[[NSFileManager defaultManager] removeItemAtPath:downloadFilename error:nil];
|
||||
#endif
|
||||
}
|
||||
[downloadFilename release];
|
||||
downloadFilename = nil;
|
||||
self.downloadFilename = nil;
|
||||
|
||||
[self reportError:error];
|
||||
}
|
||||
@@ -255,7 +238,7 @@
|
||||
{
|
||||
if ([delegate respondsToSelector:@selector(appcast:failedToLoadWithError:)])
|
||||
{
|
||||
[delegate appcast:self failedToLoadWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUAppcastError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:SULocalizedString(@"An error occurred in retrieving update information. Please try again later.", nil), NSLocalizedDescriptionKey, [error localizedDescription], NSLocalizedFailureReasonErrorKey, nil]]];
|
||||
[delegate appcast:self failedToLoadWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUAppcastError userInfo:@{NSLocalizedDescriptionKey: SULocalizedString(@"An error occurred in retrieving update information. Please try again later.", nil), NSLocalizedFailureReasonErrorKey: [error localizedDescription]}]];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -263,39 +246,23 @@
|
||||
{
|
||||
// We use this method to pick out the localized version of a node when one's available.
|
||||
if ([nodes count] == 1)
|
||||
return [nodes objectAtIndex:0];
|
||||
return nodes[0];
|
||||
else if ([nodes count] == 0)
|
||||
return nil;
|
||||
|
||||
NSEnumerator *nodeEnum = [nodes objectEnumerator];
|
||||
NSXMLElement *node;
|
||||
NSMutableArray *languages = [NSMutableArray array];
|
||||
NSString *lang;
|
||||
NSUInteger i;
|
||||
while ((node = [nodeEnum nextObject]))
|
||||
{
|
||||
for (NSXMLElement *node in nodes) {
|
||||
lang = [[node attributeForName:@"xml:lang"] stringValue];
|
||||
[languages addObject:(lang ? lang : @"")];
|
||||
}
|
||||
lang = [[NSBundle preferredLocalizationsFromArray:languages] objectAtIndex:0];
|
||||
lang = [NSBundle preferredLocalizationsFromArray:languages][0];
|
||||
i = [languages indexOfObject:([languages containsObject:lang] ? lang : @"")];
|
||||
if (i == NSNotFound)
|
||||
if (i == NSNotFound) {
|
||||
i = 0;
|
||||
return [nodes objectAtIndex:i];
|
||||
}
|
||||
|
||||
- (void)setUserAgentString:(NSString *)uas
|
||||
{
|
||||
if (uas != userAgentString)
|
||||
{
|
||||
[userAgentString release];
|
||||
userAgentString = [uas copy];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setDelegate:del
|
||||
{
|
||||
delegate = del;
|
||||
return nodes[i];
|
||||
}
|
||||
|
||||
@end
|
||||
+17
-37
@@ -10,48 +10,28 @@
|
||||
#define SUAPPCASTITEM_H
|
||||
|
||||
@interface SUAppcastItem : NSObject
|
||||
{
|
||||
@private
|
||||
NSString *title;
|
||||
NSDate *date;
|
||||
NSString *itemDescription;
|
||||
|
||||
NSURL *releaseNotesURL;
|
||||
|
||||
NSString *DSASignature;
|
||||
NSString *minimumSystemVersion;
|
||||
NSString *maximumSystemVersion;
|
||||
|
||||
NSURL *fileURL;
|
||||
NSString *versionString;
|
||||
NSString *displayVersionString;
|
||||
|
||||
NSDictionary *deltaUpdates;
|
||||
|
||||
NSDictionary *propertiesDictionary;
|
||||
|
||||
NSURL *infoURL; // UK 2007-08-31
|
||||
}
|
||||
@property (copy, readonly) NSString *title;
|
||||
@property (copy, readonly) NSDate *date;
|
||||
@property (copy, readonly) NSString *itemDescription;
|
||||
@property (retain, readonly) NSURL *releaseNotesURL;
|
||||
@property (copy, readonly) NSString *DSASignature;
|
||||
@property (copy, readonly) NSString *minimumSystemVersion;
|
||||
@property (copy, readonly) NSString *maximumSystemVersion;
|
||||
@property (retain, readonly) NSURL *fileURL;
|
||||
@property (copy, readonly) NSString *versionString;
|
||||
@property (copy, readonly) NSString *displayVersionString;
|
||||
@property (copy, readonly) NSDictionary *deltaUpdates;
|
||||
@property (retain, readonly) NSURL *infoURL; // UK 2007-08-31
|
||||
|
||||
// Initializes with data from a dictionary provided by the RSS class.
|
||||
- initWithDictionary:(NSDictionary *)dict;
|
||||
- initWithDictionary:(NSDictionary *)dict failureReason:(NSString**)error;
|
||||
- (instancetype)initWithDictionary:(NSDictionary *)dict;
|
||||
- (instancetype)initWithDictionary:(NSDictionary *)dict failureReason:(NSString**)error;
|
||||
|
||||
- (NSString *)title;
|
||||
- (NSString *)versionString;
|
||||
- (NSString *)displayVersionString;
|
||||
- (NSDate *)date;
|
||||
- (NSString *)itemDescription;
|
||||
- (NSURL *)releaseNotesURL;
|
||||
- (NSURL *)fileURL;
|
||||
- (NSString *)DSASignature;
|
||||
- (NSString *)minimumSystemVersion;
|
||||
- (NSString *)maximumSystemVersion;
|
||||
- (NSDictionary *)deltaUpdates;
|
||||
- (BOOL)isDeltaUpdate;
|
||||
@property (getter=isDeltaUpdate, readonly) BOOL deltaUpdate;
|
||||
@property (getter=isCriticalUpdate, readonly) BOOL criticalUpdate;
|
||||
|
||||
// Returns the dictionary provided in initWithDictionary; this might be useful later for extensions.
|
||||
- (NSDictionary *)propertiesDictionary;
|
||||
@property (readonly, copy) NSDictionary *propertiesDictionary;
|
||||
|
||||
- (NSURL *)infoURL; // UK 2007-08-31
|
||||
|
||||
|
||||
+89
-175
@@ -14,141 +14,58 @@
|
||||
#import "SUAppcastItem.h"
|
||||
#import "SULog.h"
|
||||
|
||||
@interface SUAppcastItem ()
|
||||
@property (copy, readwrite) NSString *title;
|
||||
@property (copy, readwrite) NSDate *date;
|
||||
@property (copy, readwrite) NSString *itemDescription;
|
||||
@property (retain, readwrite) NSURL *releaseNotesURL;
|
||||
@property (copy, readwrite) NSString *DSASignature;
|
||||
@property (copy, readwrite) NSString *minimumSystemVersion;
|
||||
@property (copy, readwrite) NSString *maximumSystemVersion;
|
||||
@property (retain, readwrite) NSURL *fileURL;
|
||||
@property (copy, readwrite) NSString *versionString;
|
||||
@property (copy, readwrite) NSString *displayVersionString;
|
||||
@property (copy, readwrite) NSDictionary *deltaUpdates;
|
||||
@property (retain, readwrite) NSURL *infoURL;
|
||||
@property (readwrite, copy) NSDictionary *propertiesDictionary;
|
||||
@end
|
||||
|
||||
@implementation SUAppcastItem
|
||||
|
||||
// Attack of accessors!
|
||||
|
||||
- (NSString *)title { return [[title retain] autorelease]; }
|
||||
|
||||
- (void)setTitle:(NSString *)aTitle
|
||||
{
|
||||
if (title == aTitle) return;
|
||||
[title release];
|
||||
title = [aTitle copy];
|
||||
}
|
||||
|
||||
|
||||
- (NSDate *)date { return [[date retain] autorelease]; }
|
||||
|
||||
- (void)setDate:(NSDate *)aDate
|
||||
{
|
||||
if (date == aDate) return;
|
||||
[date release];
|
||||
date = [aDate copy];
|
||||
}
|
||||
|
||||
|
||||
- (NSString *)itemDescription { return [[itemDescription retain] autorelease]; }
|
||||
|
||||
- (void)setItemDescription:(NSString *)anItemDescription
|
||||
{
|
||||
if (itemDescription == anItemDescription) return;
|
||||
[itemDescription release];
|
||||
itemDescription = [anItemDescription copy];
|
||||
}
|
||||
|
||||
|
||||
- (NSURL *)releaseNotesURL { return [[releaseNotesURL retain] autorelease]; }
|
||||
|
||||
- (void)setReleaseNotesURL:(NSURL *)aReleaseNotesURL
|
||||
{
|
||||
if (releaseNotesURL == aReleaseNotesURL) return;
|
||||
[releaseNotesURL release];
|
||||
releaseNotesURL = [aReleaseNotesURL copy];
|
||||
}
|
||||
|
||||
|
||||
- (NSString *)DSASignature { return [[DSASignature retain] autorelease]; }
|
||||
|
||||
- (void)setDSASignature:(NSString *)aDSASignature
|
||||
{
|
||||
if (DSASignature == aDSASignature) return;
|
||||
[DSASignature release];
|
||||
DSASignature = [aDSASignature copy];
|
||||
}
|
||||
|
||||
|
||||
- (NSURL *)fileURL { return [[fileURL retain] autorelease]; }
|
||||
|
||||
- (void)setFileURL:(NSURL *)aFileURL
|
||||
{
|
||||
if (fileURL == aFileURL) return;
|
||||
[fileURL release];
|
||||
fileURL = [aFileURL copy];
|
||||
}
|
||||
|
||||
|
||||
- (NSString *)versionString { return [[versionString retain] autorelease]; }
|
||||
|
||||
- (void)setVersionString:(NSString *)s
|
||||
{
|
||||
if (versionString == s) return;
|
||||
[versionString release];
|
||||
versionString = [s copy];
|
||||
}
|
||||
|
||||
|
||||
- (NSString *)displayVersionString { return [[displayVersionString retain] autorelease]; }
|
||||
|
||||
- (void)setDisplayVersionString:(NSString *)s
|
||||
{
|
||||
if (displayVersionString == s) return;
|
||||
[displayVersionString release];
|
||||
displayVersionString = [s copy];
|
||||
}
|
||||
|
||||
|
||||
- (NSString *)minimumSystemVersion { return [[minimumSystemVersion retain] autorelease]; }
|
||||
- (void)setMinimumSystemVersion:(NSString *)systemVersionString
|
||||
{
|
||||
if (minimumSystemVersion == systemVersionString) return;
|
||||
[minimumSystemVersion release];
|
||||
minimumSystemVersion = [systemVersionString copy];
|
||||
}
|
||||
|
||||
- (NSString *)maximumSystemVersion { return [[maximumSystemVersion retain] autorelease]; }
|
||||
- (void)setMaximumSystemVersion:(NSString *)systemVersionString
|
||||
{
|
||||
if (maximumSystemVersion == systemVersionString) return;
|
||||
[maximumSystemVersion release];
|
||||
maximumSystemVersion = [systemVersionString copy];
|
||||
}
|
||||
|
||||
|
||||
- (NSURL *)infoURL { return [[infoURL retain] autorelease]; } // UK 2007-08-31 (whole method)
|
||||
|
||||
- (void)setInfoURL:(NSURL *)aFileURL // UK 2007-08-31 (whole method)
|
||||
{
|
||||
if( aFileURL == infoURL ) return;
|
||||
[infoURL release];
|
||||
infoURL = [aFileURL copy];
|
||||
}
|
||||
|
||||
- (NSDictionary *)deltaUpdates { return [[deltaUpdates retain] autorelease]; }
|
||||
|
||||
- (void)setDeltaUpdates:(NSDictionary *)updates
|
||||
{
|
||||
if (deltaUpdates == updates) return;
|
||||
[deltaUpdates release];
|
||||
deltaUpdates = [updates copy];
|
||||
}
|
||||
@synthesize date;
|
||||
@synthesize deltaUpdates;
|
||||
@synthesize displayVersionString;
|
||||
@synthesize DSASignature;
|
||||
@synthesize fileURL;
|
||||
@synthesize infoURL;
|
||||
@synthesize itemDescription;
|
||||
@synthesize maximumSystemVersion;
|
||||
@synthesize minimumSystemVersion;
|
||||
@synthesize releaseNotesURL;
|
||||
@synthesize title;
|
||||
@synthesize versionString;
|
||||
@synthesize propertiesDictionary;
|
||||
|
||||
- (BOOL)isDeltaUpdate
|
||||
{
|
||||
return [[propertiesDictionary objectForKey:@"enclosure"] objectForKey:@"sparkle:deltaFrom"] != nil;
|
||||
return propertiesDictionary[@"enclosure"][@"sparkle:deltaFrom"] != nil;
|
||||
}
|
||||
|
||||
- initWithDictionary:(NSDictionary *)dict
|
||||
- (BOOL)isCriticalUpdate
|
||||
{
|
||||
return [propertiesDictionary[@"sparkle:tags"] containsObject:@"sparkle:criticalUpdate"];
|
||||
}
|
||||
|
||||
- (instancetype) initWithDictionary:(NSDictionary *)dict
|
||||
{
|
||||
return [self initWithDictionary:dict failureReason:nil];
|
||||
}
|
||||
|
||||
- initWithDictionary:(NSDictionary *)dict failureReason:(NSString**)error
|
||||
- (instancetype) initWithDictionary:(NSDictionary *)dict failureReason:(NSString**)error
|
||||
{
|
||||
self = [super init];
|
||||
if (self)
|
||||
{
|
||||
id enclosure = [dict objectForKey:@"enclosure"];
|
||||
id enclosure = dict[@"enclosure"];
|
||||
|
||||
// Try to find a version string.
|
||||
// Finding the new version number from the RSS feed is a little bit hacky. There are two ways:
|
||||
@@ -158,14 +75,14 @@
|
||||
// underscore and the last period as the version number. So name your packages like this: APPNAME_VERSION.extension.
|
||||
// The big caveat with this is that you can't have underscores in your version strings, as that'll confuse Sparkle.
|
||||
// Feel free to change the separator string to a hyphen or something more suited to your needs if you like.
|
||||
NSString *newVersion = [enclosure objectForKey:@"sparkle:version"];
|
||||
NSString *newVersion = enclosure[@"sparkle:version"];
|
||||
if( newVersion == nil )
|
||||
newVersion = [dict objectForKey:@"sparkle:version"]; // UK 2007-08-31 Get version from the item, in case it's a download-less item (i.e. paid upgrade).
|
||||
newVersion = dict[@"sparkle:version"]; // UK 2007-08-31 Get version from the item, in case it's a download-less item (i.e. paid upgrade).
|
||||
if (newVersion == nil) // no sparkle:version attribute anywhere?
|
||||
{
|
||||
// Separate the url by underscores and take the last component, as that'll be closest to the end,
|
||||
// then we remove the extension. Hopefully, this will be the version.
|
||||
NSArray *fileComponents = [[enclosure objectForKey:@"url"] componentsSeparatedByString:@"_"];
|
||||
NSArray *fileComponents = [enclosure[@"url"] componentsSeparatedByString:@"_"];
|
||||
if ([fileComponents count] > 1)
|
||||
newVersion = [[fileComponents lastObject] stringByDeletingPathExtension];
|
||||
}
|
||||
@@ -179,17 +96,17 @@
|
||||
}
|
||||
|
||||
propertiesDictionary = [[NSMutableDictionary alloc] initWithDictionary:dict];
|
||||
[self setTitle:[dict objectForKey:@"title"]];
|
||||
[self setDate:[dict objectForKey:@"pubDate"]];
|
||||
[self setItemDescription:[dict objectForKey:@"description"]];
|
||||
self.title = dict[@"title"];
|
||||
self.date = dict[@"pubDate"];
|
||||
self.itemDescription = dict[@"description"];
|
||||
|
||||
NSString* theInfoURL = [dict objectForKey:@"link"];
|
||||
NSString* theInfoURL = dict[@"link"];
|
||||
if( theInfoURL )
|
||||
{
|
||||
if( ![theInfoURL isKindOfClass: [NSString class]] )
|
||||
SULog(@"SUAppcastItem -initWithDictionary: Info URL is not of valid type.");
|
||||
else
|
||||
[self setInfoURL:[NSURL URLWithString:theInfoURL]];
|
||||
self.infoURL = [NSURL URLWithString:theInfoURL];
|
||||
}
|
||||
|
||||
// Need an info URL or an enclosure URL. Former to show "More Info"
|
||||
@@ -202,59 +119,61 @@
|
||||
return nil;
|
||||
}
|
||||
|
||||
NSString* enclosureURLString = [enclosure objectForKey:@"url"];
|
||||
NSString* enclosureURLString = enclosure[@"url"];
|
||||
if( !enclosureURLString && !theInfoURL )
|
||||
{
|
||||
if (error)
|
||||
if (error) {
|
||||
*error = @"Feed item's enclosure lacks URL";
|
||||
}
|
||||
[self release];
|
||||
return nil;
|
||||
}
|
||||
|
||||
if( enclosureURLString )
|
||||
[self setFileURL: [NSURL URLWithString: [enclosureURLString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]];
|
||||
if( enclosure )
|
||||
[self setDSASignature:[enclosure objectForKey:@"sparkle:dsaSignature"]];
|
||||
if( enclosureURLString ) {
|
||||
NSString *fileURLString = [[enclosureURLString stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
|
||||
self.fileURL = [NSURL URLWithString:fileURLString];
|
||||
}
|
||||
if (enclosure) {
|
||||
self.DSASignature = enclosure[@"sparkle:dsaSignature"];
|
||||
}
|
||||
|
||||
[self setVersionString: newVersion];
|
||||
[self setMinimumSystemVersion: [dict objectForKey:@"sparkle:minimumSystemVersion"]];
|
||||
[self setMaximumSystemVersion: [dict objectForKey:@"sparkle:maximumSystemVersion"]];
|
||||
self.versionString = newVersion;
|
||||
self.minimumSystemVersion = dict[@"sparkle:minimumSystemVersion"];
|
||||
self.maximumSystemVersion = dict[@"sparkle:maximumSystemVersion"];
|
||||
|
||||
NSString *shortVersionString = [enclosure objectForKey:@"sparkle:shortVersionString"];
|
||||
if (nil == shortVersionString)
|
||||
shortVersionString = [dict objectForKey:@"sparkle:shortVersionString"]; // fall back on the <item>
|
||||
NSString *shortVersionString = enclosure[@"sparkle:shortVersionString"];
|
||||
if (nil == shortVersionString) {
|
||||
shortVersionString = dict[@"sparkle:shortVersionString"]; // fall back on the <item>
|
||||
}
|
||||
|
||||
if (shortVersionString)
|
||||
[self setDisplayVersionString: shortVersionString];
|
||||
self.displayVersionString = shortVersionString;
|
||||
else
|
||||
[self setDisplayVersionString: [self versionString]];
|
||||
self.displayVersionString = [self versionString];
|
||||
|
||||
// Find the appropriate release notes URL.
|
||||
if ([dict objectForKey:@"sparkle:releaseNotesLink"])
|
||||
[self setReleaseNotesURL:[NSURL URLWithString:[dict objectForKey:@"sparkle:releaseNotesLink"]]];
|
||||
else if ([[self itemDescription] hasPrefix:@"http://"] || [[self itemDescription] hasPrefix:@"https://"]) // if the description starts with http:// or https:// use that.
|
||||
[self setReleaseNotesURL:[NSURL URLWithString:[self itemDescription]]];
|
||||
if (dict[@"sparkle:releaseNotesLink"])
|
||||
self.releaseNotesURL = [NSURL URLWithString:dict[@"sparkle:releaseNotesLink"]];
|
||||
else if ([self.itemDescription hasPrefix:@"http://"] || [self.itemDescription hasPrefix:@"https://"]) // if the description starts with http:// or https:// use that.
|
||||
self.releaseNotesURL = [NSURL URLWithString:self.itemDescription];
|
||||
else
|
||||
[self setReleaseNotesURL:nil];
|
||||
self.releaseNotesURL = nil;
|
||||
|
||||
if ([dict objectForKey:@"deltas"])
|
||||
if (dict[@"deltas"])
|
||||
{
|
||||
NSMutableDictionary *deltas = [NSMutableDictionary dictionary];
|
||||
NSArray *deltaDictionaries = [dict objectForKey:@"deltas"];
|
||||
NSEnumerator *deltaDictionariesEnum = [deltaDictionaries objectEnumerator];
|
||||
NSDictionary *deltaDictionary;
|
||||
while ((deltaDictionary = [deltaDictionariesEnum nextObject]))
|
||||
{
|
||||
NSMutableDictionary *fakeAppCastDict = [dict mutableCopy];
|
||||
NSArray *deltaDictionaries = dict[@"deltas"];
|
||||
for (NSDictionary *deltaDictionary in deltaDictionaries) {
|
||||
NSMutableDictionary *fakeAppCastDict = [dict mutableCopy];
|
||||
[fakeAppCastDict removeObjectForKey:@"deltas"];
|
||||
[fakeAppCastDict setObject:deltaDictionary forKey:@"enclosure"];
|
||||
fakeAppCastDict[@"enclosure"] = deltaDictionary;
|
||||
SUAppcastItem *deltaItem = [[[self class] alloc] initWithDictionary:fakeAppCastDict];
|
||||
[fakeAppCastDict release];
|
||||
|
||||
[deltas setObject:deltaItem forKey:[deltaDictionary objectForKey:@"sparkle:deltaFrom"]];
|
||||
deltas[deltaDictionary[@"sparkle:deltaFrom"]] = deltaItem;
|
||||
[deltaItem release];
|
||||
}
|
||||
[self setDeltaUpdates:deltas];
|
||||
}
|
||||
self.deltaUpdates = deltas;
|
||||
}
|
||||
}
|
||||
return self;
|
||||
@@ -262,23 +181,18 @@
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[self setTitle:nil];
|
||||
[self setDate:nil];
|
||||
[self setItemDescription:nil];
|
||||
[self setReleaseNotesURL:nil];
|
||||
[self setDSASignature:nil];
|
||||
[self setMinimumSystemVersion: nil];
|
||||
[self setFileURL:nil];
|
||||
[self setVersionString:nil];
|
||||
[self setDisplayVersionString:nil];
|
||||
[self setInfoURL:nil];
|
||||
[propertiesDictionary release];
|
||||
self.title = nil;
|
||||
self.date = nil;
|
||||
self.itemDescription = nil;
|
||||
self.releaseNotesURL = nil;
|
||||
self.DSASignature = nil;
|
||||
self.minimumSystemVersion = nil;
|
||||
self.fileURL = nil;
|
||||
self.versionString = nil;
|
||||
self.displayVersionString = nil;
|
||||
self.infoURL = nil;
|
||||
self.propertiesDictionary = nil;
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (NSDictionary *)propertiesDictionary
|
||||
{
|
||||
return propertiesDictionary;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -11,6 +11,8 @@
|
||||
|
||||
#import "SUWindowController.h"
|
||||
|
||||
@protocol SUAutomaticUpdateAlertDelegateProtocol;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SUInstallNowChoice,
|
||||
@@ -19,20 +21,16 @@ typedef enum
|
||||
} SUAutomaticInstallationChoice;
|
||||
|
||||
@class SUAppcastItem, SUHost;
|
||||
@interface SUAutomaticUpdateAlert : SUWindowController {
|
||||
SUAppcastItem *updateItem;
|
||||
id delegate;
|
||||
SUHost *host;
|
||||
}
|
||||
@interface SUAutomaticUpdateAlert : SUWindowController
|
||||
|
||||
- (id)initWithAppcastItem:(SUAppcastItem *)item host:(SUHost *)hostBundle delegate:delegate;
|
||||
- (instancetype)initWithAppcastItem:(SUAppcastItem *)item host:(SUHost *)hostBundle delegate:(id<SUAutomaticUpdateAlertDelegateProtocol>)delegate;
|
||||
- (IBAction)installNow:sender;
|
||||
- (IBAction)installLater:sender;
|
||||
- (IBAction)doNotInstall:sender;
|
||||
|
||||
@end
|
||||
|
||||
@interface NSObject (SUAutomaticUpdateAlertDelegateProtocol)
|
||||
@protocol SUAutomaticUpdateAlertDelegateProtocol <NSObject>
|
||||
- (void)automaticUpdateAlert:(SUAutomaticUpdateAlert *)aua finishedWithChoice:(SUAutomaticInstallationChoice)choice;
|
||||
@end
|
||||
|
||||
|
||||
+35
-12
@@ -10,16 +10,25 @@
|
||||
|
||||
#import "SUHost.h"
|
||||
|
||||
@implementation SUAutomaticUpdateAlert
|
||||
@interface SUAutomaticUpdateAlert ()
|
||||
@property (retain) SUAppcastItem *updateItem;
|
||||
@property (assign) id<SUAutomaticUpdateAlertDelegateProtocol> delegate;
|
||||
@property (retain) SUHost *host;
|
||||
@end
|
||||
|
||||
- (id)initWithAppcastItem:(SUAppcastItem *)item host:(SUHost *)aHost delegate:del;
|
||||
@implementation SUAutomaticUpdateAlert
|
||||
@synthesize delegate;
|
||||
@synthesize host;
|
||||
@synthesize updateItem;
|
||||
|
||||
- (instancetype)initWithAppcastItem:(SUAppcastItem *)item host:(SUHost *)aHost delegate:(id<SUAutomaticUpdateAlertDelegateProtocol>)del
|
||||
{
|
||||
self = [super initWithHost:aHost windowNibName:@"SUAutomaticUpdateAlert"];
|
||||
if (self)
|
||||
{
|
||||
updateItem = [item retain];
|
||||
delegate = del;
|
||||
host = [aHost retain];
|
||||
self.updateItem = item;
|
||||
self.delegate = del;
|
||||
self.host = aHost;
|
||||
[self setShouldCascadeWindows:NO];
|
||||
[[self window] center];
|
||||
}
|
||||
@@ -28,26 +37,26 @@
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[host release];
|
||||
[updateItem release];
|
||||
self.host = nil;
|
||||
self.updateItem = nil;
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (NSString *)description { return [NSString stringWithFormat:@"%@ <%@, %@>", [self class], [host bundlePath], [host installationPath]]; }
|
||||
|
||||
- (IBAction)installNow:sender
|
||||
- (IBAction)installNow:(id)sender
|
||||
{
|
||||
[self close];
|
||||
[delegate automaticUpdateAlert:self finishedWithChoice:SUInstallNowChoice];
|
||||
}
|
||||
|
||||
- (IBAction)installLater:sender
|
||||
- (IBAction)installLater:(id)sender
|
||||
{
|
||||
[self close];
|
||||
[delegate automaticUpdateAlert:self finishedWithChoice:SUInstallLaterChoice];
|
||||
}
|
||||
|
||||
- (IBAction)doNotInstall:sender
|
||||
- (IBAction)doNotInstall:(id)sender
|
||||
{
|
||||
[self close];
|
||||
[delegate automaticUpdateAlert:self finishedWithChoice:SUDoNotInstallChoice];
|
||||
@@ -60,12 +69,26 @@
|
||||
|
||||
- (NSString *)titleText
|
||||
{
|
||||
return [NSString stringWithFormat:SULocalizedString(@"A new version of %@ is ready to install!", nil), [host name]];
|
||||
if ([updateItem isCriticalUpdate])
|
||||
{
|
||||
return [NSString stringWithFormat:SULocalizedString(@"An important update to %@ is ready to install", nil), [host name]];
|
||||
}
|
||||
else
|
||||
{
|
||||
return [NSString stringWithFormat:SULocalizedString(@"A new version of %@ is ready to install!", nil), [host name]];
|
||||
}
|
||||
}
|
||||
|
||||
- (NSString *)descriptionText
|
||||
{
|
||||
return [NSString stringWithFormat:SULocalizedString(@"%1$@ %2$@ has been downloaded and is ready to use! Would you like to install it and relaunch %1$@ now?", nil), [host name], [updateItem displayVersionString]];
|
||||
if ([updateItem isCriticalUpdate])
|
||||
{
|
||||
return [NSString stringWithFormat:SULocalizedString(@"%1$@ %2$@ has been downloaded and is ready to use! This is an important update; would you like to install it and relaunch %1$@ now?", nil), [host name], [updateItem displayVersionString]];
|
||||
}
|
||||
else
|
||||
{
|
||||
return [NSString stringWithFormat:SULocalizedString(@"%1$@ %2$@ has been downloaded and is ready to use! Would you like to install it and relaunch %1$@ now?", nil), [host name], [updateItem displayVersionString]];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -11,13 +11,15 @@
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "SUBasicUpdateDriver.h"
|
||||
#import "SUAutomaticUpdateAlert.h"
|
||||
|
||||
@class SUAutomaticUpdateAlert;
|
||||
@interface SUAutomaticUpdateDriver : SUBasicUpdateDriver
|
||||
@interface SUAutomaticUpdateDriver : SUBasicUpdateDriver <SUUnarchiverDelegate, SUAutomaticUpdateAlertDelegateProtocol>
|
||||
{
|
||||
@private
|
||||
BOOL postponingInstallation, showErrors;
|
||||
BOOL willUpdateOnTermination;
|
||||
SUAutomaticUpdateAlert *alert;
|
||||
NSTimer *showUpdateAlertTimer;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -12,10 +12,14 @@
|
||||
#import "SUHost.h"
|
||||
#import "SUConstants.h"
|
||||
|
||||
// If the user hasn't quit in a week, ask them if they want to relaunch to get the latest bits. It doesn't matter that this measure of "one day" is imprecise.
|
||||
static const NSTimeInterval SUAutomaticUpdatePromptImpatienceTimer = 60 * 60 * 24 * 7;
|
||||
|
||||
@implementation SUAutomaticUpdateDriver
|
||||
|
||||
- (void)unarchiverDidFinish:(SUUnarchiver *)ua
|
||||
- (void)showUpdateAlert
|
||||
{
|
||||
isInterruptible = NO;
|
||||
alert = [[SUAutomaticUpdateAlert alloc] initWithAppcastItem:updateItem host:host delegate:self];
|
||||
|
||||
// If the app is a menubar app or the like, we need to focus it first and alter the
|
||||
@@ -33,6 +37,80 @@
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidBecomeActive:) name:NSApplicationDidBecomeActiveNotification object:NSApp];
|
||||
}
|
||||
|
||||
- (void)unarchiverDidFinish:(SUUnarchiver *)ua
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationWillTerminate:) name:NSApplicationWillTerminateNotification object:nil];
|
||||
|
||||
// Sudden termination is available on 10.6+
|
||||
NSProcessInfo *processInfo = [NSProcessInfo processInfo];
|
||||
[processInfo disableSuddenTermination];
|
||||
|
||||
willUpdateOnTermination = YES;
|
||||
|
||||
if ([[updater delegate] respondsToSelector:@selector(updater:willInstallUpdateOnQuit:immediateInstallationInvocation:)])
|
||||
{
|
||||
BOOL relaunch = YES;
|
||||
BOOL showUI = NO;
|
||||
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[[self class] instanceMethodSignatureForSelector:@selector(installWithToolAndRelaunch:displayingUserInterface:)]];
|
||||
[invocation setSelector:@selector(installWithToolAndRelaunch:displayingUserInterface:)];
|
||||
[invocation setArgument:&relaunch atIndex:2];
|
||||
[invocation setArgument:&showUI atIndex:3];
|
||||
[invocation setTarget:self];
|
||||
|
||||
[[updater delegate] updater:updater willInstallUpdateOnQuit:updateItem immediateInstallationInvocation:invocation];
|
||||
}
|
||||
|
||||
// If this is marked as a critical update, we'll prompt the user to install it right away.
|
||||
if ([updateItem isCriticalUpdate])
|
||||
{
|
||||
[self showUpdateAlert];
|
||||
}
|
||||
else
|
||||
{
|
||||
showUpdateAlertTimer = [[NSTimer scheduledTimerWithTimeInterval:SUAutomaticUpdatePromptImpatienceTimer target:self selector:@selector(showUpdateAlert) userInfo:nil repeats:NO] retain];
|
||||
|
||||
// At this point the driver is idle, allow it to be interrupted for user-initiated update checks.
|
||||
isInterruptible = YES;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)stopUpdatingOnTermination
|
||||
{
|
||||
if (willUpdateOnTermination)
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self name:NSApplicationWillTerminateNotification object:nil];
|
||||
NSProcessInfo *processInfo = [NSProcessInfo processInfo];
|
||||
[processInfo enableSuddenTermination];
|
||||
|
||||
willUpdateOnTermination = NO;
|
||||
|
||||
if ([[updater delegate] respondsToSelector:@selector(updater:didCancelInstallUpdateOnQuit:)])
|
||||
[[updater delegate] updater:updater didCancelInstallUpdateOnQuit:updateItem];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)invalidateShowUpdateAlertTimer
|
||||
{
|
||||
[showUpdateAlertTimer invalidate];
|
||||
[showUpdateAlertTimer release];
|
||||
showUpdateAlertTimer = nil;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[self stopUpdatingOnTermination];
|
||||
[self invalidateShowUpdateAlertTimer];
|
||||
[alert release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void)abortUpdate
|
||||
{
|
||||
[self stopUpdatingOnTermination];
|
||||
[self invalidateShowUpdateAlertTimer];
|
||||
[super abortUpdate];
|
||||
}
|
||||
|
||||
- (void)applicationDidBecomeActive:(NSNotification *)aNotification
|
||||
{
|
||||
[[alert window] makeKeyAndOrderFront:self];
|
||||
@@ -44,12 +122,15 @@
|
||||
switch (choice)
|
||||
{
|
||||
case SUInstallNowChoice:
|
||||
[self stopUpdatingOnTermination];
|
||||
[self installWithToolAndRelaunch:YES];
|
||||
break;
|
||||
|
||||
case SUInstallLaterChoice:
|
||||
postponingInstallation = YES;
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationWillTerminate:) name:NSApplicationWillTerminateNotification object:nil];
|
||||
// We're already waiting on quit, just indicate that we're idle.
|
||||
isInterruptible = YES;
|
||||
break;
|
||||
|
||||
case SUDoNotInstallChoice:
|
||||
@@ -61,10 +142,14 @@
|
||||
|
||||
- (BOOL)shouldInstallSynchronously { return postponingInstallation; }
|
||||
|
||||
- (void)installWithToolAndRelaunch:(BOOL)relaunch
|
||||
- (void)installWithToolAndRelaunch:(BOOL)relaunch displayingUserInterface:(BOOL)showUI
|
||||
{
|
||||
showErrors = YES;
|
||||
[super installWithToolAndRelaunch:relaunch];
|
||||
if (relaunch) {
|
||||
[self stopUpdatingOnTermination];
|
||||
}
|
||||
|
||||
showErrors = YES;
|
||||
[super installWithToolAndRelaunch:relaunch displayingUserInterface:showUI];
|
||||
}
|
||||
|
||||
- (void)applicationWillTerminate:(NSNotification *)note
|
||||
|
||||
@@ -11,9 +11,11 @@
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "SUUpdateDriver.h"
|
||||
#import "SUUnarchiver.h"
|
||||
#import "SUAppcast.h"
|
||||
|
||||
@class SUAppcastItem, SUUnarchiver, SUAppcast, SUUnarchiver, SUHost;
|
||||
@interface SUBasicUpdateDriver : SUUpdateDriver {
|
||||
@class SUAppcastItem, SUHost;
|
||||
@interface SUBasicUpdateDriver : SUUpdateDriver<NSURLDownloadDelegate, SUUnarchiverDelegate, SUAppcastDelegate> {
|
||||
SUAppcastItem *updateItem;
|
||||
SUAppcastItem *nonDeltaUpdateItem;
|
||||
|
||||
@@ -26,9 +28,6 @@
|
||||
|
||||
- (void)checkForUpdatesAtURL:(NSURL *)URL host:(SUHost *)host;
|
||||
|
||||
- (void)appcastDidFinishLoading:(SUAppcast *)ac;
|
||||
- (void)appcast:(SUAppcast *)ac failedToLoadWithError:(NSError *)error;
|
||||
|
||||
- (BOOL)isItemNewer:(SUAppcastItem *)ui;
|
||||
- (BOOL)hostSupportsItem:(SUAppcastItem *)ui;
|
||||
- (BOOL)itemContainsSkippedVersion:(SUAppcastItem *)ui;
|
||||
@@ -47,9 +46,9 @@
|
||||
- (void)failedToApplyDeltaUpdate;
|
||||
|
||||
- (void)installWithToolAndRelaunch:(BOOL)relaunch;
|
||||
- (void)installWithToolAndRelaunch:(BOOL)relaunch displayingUserInterface:(BOOL)showUI;
|
||||
- (void)installerForHost:(SUHost *)host failedWithError:(NSError *)error;
|
||||
|
||||
- (void)installWithToolAndRelaunch:(BOOL)relaunch;
|
||||
- (void)cleanUpDownload;
|
||||
|
||||
- (void)abortUpdate;
|
||||
|
||||
+78
-67
@@ -21,8 +21,14 @@
|
||||
#import "SUCodeSigningVerifier.h"
|
||||
#import "SUUpdater_Private.h"
|
||||
|
||||
@interface SUBasicUpdateDriver () <NSURLDownloadDelegate>; @end
|
||||
|
||||
#ifdef FINISH_INSTALL_TOOL_NAME
|
||||
// FINISH_INSTALL_TOOL_NAME expands to unquoted finish_install
|
||||
#define QUOTE_NS_STRING2(str) @"" #str
|
||||
#define QUOTE_NS_STRING1(str) QUOTE_NS_STRING2(str)
|
||||
#define FINISH_INSTALL_TOOL_NAME_STRING QUOTE_NS_STRING1(FINISH_INSTALL_TOOL_NAME)
|
||||
#else
|
||||
#error FINISH_INSTALL_TOOL_NAME not defined
|
||||
#endif
|
||||
|
||||
@implementation SUBasicUpdateDriver
|
||||
|
||||
@@ -31,7 +37,7 @@
|
||||
[super checkForUpdatesAtURL:URL host:aHost];
|
||||
if ([aHost isRunningOnReadOnlyVolume])
|
||||
{
|
||||
[self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SURunningFromDiskImageError userInfo:[NSDictionary dictionaryWithObject:[NSString stringWithFormat:SULocalizedString(@"%1$@ can't be updated when it's running from a read-only volume like a disk image or an optical drive. Move %1$@ to your Applications folder, relaunch it from there, and try again.", nil), [aHost name]] forKey:NSLocalizedDescriptionKey]]];
|
||||
[self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SURunningFromDiskImageError userInfo:@{NSLocalizedDescriptionKey: [NSString stringWithFormat:SULocalizedString(@"%1$@ can't be updated when it's running from a read-only volume like a disk image or an optical drive. Move %1$@ to your Applications folder, relaunch it from there, and try again.", nil), [aHost name]]}]];
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -49,12 +55,14 @@
|
||||
id <SUVersionComparison> comparator = nil;
|
||||
|
||||
// Give the delegate a chance to provide a custom version comparator
|
||||
if ([[updater delegate] respondsToSelector:@selector(versionComparatorForUpdater:)])
|
||||
if ([[updater delegate] respondsToSelector:@selector(versionComparatorForUpdater:)]) {
|
||||
comparator = [[updater delegate] versionComparatorForUpdater:updater];
|
||||
}
|
||||
|
||||
// If we don't get a comparator from the delegate, use the default comparator
|
||||
if (!comparator)
|
||||
if (!comparator) {
|
||||
comparator = [SUStandardVersionComparator defaultComparator];
|
||||
}
|
||||
|
||||
return comparator;
|
||||
}
|
||||
@@ -97,8 +105,12 @@
|
||||
|
||||
- (void)appcastDidFinishLoading:(SUAppcast *)ac
|
||||
{
|
||||
if ([[updater delegate] respondsToSelector:@selector(updater:didFinishLoadingAppcast:)])
|
||||
if ([[updater delegate] respondsToSelector:@selector(updater:didFinishLoadingAppcast:)]) {
|
||||
[[updater delegate] updater:updater didFinishLoadingAppcast:ac];
|
||||
}
|
||||
|
||||
NSDictionary *userInfo = (ac != nil) ? @{SUUpdaterAppcastNotificationKey : ac} : nil;
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:SUUpdaterDidFinishLoadingAppCastNotification object:updater userInfo:userInfo];
|
||||
|
||||
SUAppcastItem *item = nil;
|
||||
|
||||
@@ -116,7 +128,7 @@
|
||||
} while (item && ![self hostSupportsItem:item]);
|
||||
|
||||
if (binaryDeltaSupported()) {
|
||||
SUAppcastItem *deltaUpdateItem = [[item deltaUpdates] objectForKey:[host version]];
|
||||
SUAppcastItem *deltaUpdateItem = [item deltaUpdates][[host version]];
|
||||
if (deltaUpdateItem && [self hostSupportsItem:deltaUpdateItem]) {
|
||||
nonDeltaUpdateItem = [item retain];
|
||||
item = deltaUpdateItem;
|
||||
@@ -144,14 +156,19 @@
|
||||
{
|
||||
if ([[updater delegate] respondsToSelector:@selector(updater:didFindValidUpdate:)])
|
||||
[[updater delegate] updater:updater didFindValidUpdate:updateItem];
|
||||
NSDictionary *userInfo = (updateItem != nil) ? @{SUUpdaterAppcastItemNotificationKey : updateItem} : nil;
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:SUUpdaterDidFindValidUpdateNotification object:updater userInfo:userInfo];
|
||||
[self downloadUpdate];
|
||||
}
|
||||
|
||||
- (void)didNotFindUpdate
|
||||
{
|
||||
if ([[updater delegate] respondsToSelector:@selector(updaterDidNotFindUpdate:)])
|
||||
if ([[updater delegate] respondsToSelector:@selector(updaterDidNotFindUpdate:)]) {
|
||||
[[updater delegate] updaterDidNotFindUpdate:updater];
|
||||
[self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUNoUpdateError userInfo:[NSDictionary dictionaryWithObject:[NSString stringWithFormat:SULocalizedString(@"You already have the newest version of %@.", nil), [host name]] forKey:NSLocalizedDescriptionKey]]];
|
||||
}
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:SUUpdaterDidNotFindUpdateNotification object:updater];
|
||||
|
||||
[self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUNoUpdateError userInfo:@{NSLocalizedDescriptionKey: [NSString stringWithFormat:SULocalizedString(@"You already have the newest version of %@.", nil), [host name]]}]];
|
||||
}
|
||||
|
||||
- (void)downloadUpdate
|
||||
@@ -163,10 +180,6 @@
|
||||
|
||||
- (void)download:(NSURLDownload *)d decideDestinationWithSuggestedFilename:(NSString *)name
|
||||
{
|
||||
// If name ends in .txt, the server probably has a stupid MIME configuration. We'll give the developer the benefit of the doubt and chop that off.
|
||||
if ([[name pathExtension] isEqualToString:@"txt"])
|
||||
name = [name stringByDeletingPathExtension];
|
||||
|
||||
NSString *downloadFileName = [NSString stringWithFormat:@"%@ %@", [host name], [updateItem versionString]];
|
||||
|
||||
|
||||
@@ -180,26 +193,14 @@
|
||||
}
|
||||
|
||||
// Create the temporary directory if necessary.
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4
|
||||
BOOL success = YES;
|
||||
NSEnumerator *pathComponentEnumerator = [[tempDir pathComponents] objectEnumerator];
|
||||
NSString *pathComponentAccumulator = @"";
|
||||
NSString *currentPathComponent;
|
||||
while ((currentPathComponent = [pathComponentEnumerator nextObject])) {
|
||||
pathComponentAccumulator = [pathComponentAccumulator stringByAppendingPathComponent:currentPathComponent];
|
||||
if ([[NSFileManager defaultManager] fileExistsAtPath:pathComponentAccumulator]) continue;
|
||||
success &= [[NSFileManager defaultManager] createDirectoryAtPath:pathComponentAccumulator attributes:nil];
|
||||
}
|
||||
#else
|
||||
BOOL success = [[NSFileManager defaultManager] createDirectoryAtPath:tempDir withIntermediateDirectories:YES attributes:nil error:NULL];
|
||||
#endif
|
||||
if (!success)
|
||||
{
|
||||
// Okay, something's really broken with this user's file structure.
|
||||
[download cancel];
|
||||
[self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUTemporaryDirectoryError userInfo:[NSDictionary dictionaryWithObject:[NSString stringWithFormat:@"Can't make a temporary directory for the update download at %@.",tempDir] forKey:NSLocalizedDescriptionKey]]];
|
||||
[self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUTemporaryDirectoryError userInfo:@{NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Can't make a temporary directory for the update download at %@.",tempDir]}]];
|
||||
}
|
||||
|
||||
|
||||
downloadPath = [[tempDir stringByAppendingPathComponent:name] retain];
|
||||
[download setDestination:downloadPath allowOverwrite:YES];
|
||||
}
|
||||
@@ -227,7 +228,7 @@
|
||||
|
||||
- (void)download:(NSURLDownload *)download didFailWithError:(NSError *)error
|
||||
{
|
||||
[self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SURelaunchError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:SULocalizedString(@"An error occurred while downloading the update. Please try again later.", nil), NSLocalizedDescriptionKey, [error localizedDescription], NSLocalizedFailureReasonErrorKey, nil]]];
|
||||
[self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SURelaunchError userInfo:@{NSLocalizedDescriptionKey: SULocalizedString(@"An error occurred while downloading the update. Please try again later.", nil), NSLocalizedFailureReasonErrorKey: [error localizedDescription]}]];
|
||||
}
|
||||
|
||||
- (BOOL)download:(NSURLDownload *)download shouldDecodeSourceDataOfMIMEType:(NSString *)encodingType
|
||||
@@ -276,17 +277,23 @@
|
||||
return;
|
||||
}
|
||||
|
||||
[self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:[NSDictionary dictionaryWithObject:SULocalizedString(@"An error occurred while extracting the archive. Please try again later.", nil) forKey:NSLocalizedDescriptionKey]]];
|
||||
[self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:@{NSLocalizedDescriptionKey: SULocalizedString(@"An error occurred while extracting the archive. Please try again later.", nil)}]];
|
||||
}
|
||||
|
||||
- (BOOL)shouldInstallSynchronously { return NO; }
|
||||
|
||||
- (void)installWithToolAndRelaunch:(BOOL)relaunch
|
||||
{
|
||||
// Perhaps a poor assumption but: if we're not relaunching, we assume we shouldn't be showing any UI either. Because non-relaunching installations are kicked off without any user interaction, we shouldn't be interrupting them.
|
||||
[self installWithToolAndRelaunch:relaunch displayingUserInterface:relaunch];
|
||||
}
|
||||
|
||||
- (void)installWithToolAndRelaunch:(BOOL)relaunch displayingUserInterface:(BOOL)showUI
|
||||
{
|
||||
#if !ENDANGER_USERS_WITH_INSECURE_UPDATES
|
||||
if (![self validateUpdateDownloadedToPath:downloadPath extractedToPath:tempDir DSASignature:[updateItem DSASignature] publicDSAKey:[host publicDSAKey]])
|
||||
{
|
||||
[self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUSignatureError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:SULocalizedString(@"An error occurred while extracting the archive. Please try again later.", nil), NSLocalizedDescriptionKey, @"The update is improperly signed.", NSLocalizedFailureReasonErrorKey, nil]]];
|
||||
[self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUSignatureError userInfo:@{NSLocalizedDescriptionKey: SULocalizedString(@"An error occurred while extracting the archive. Please try again later.", nil), NSLocalizedFailureReasonErrorKey: @"The update is improperly signed."}]];
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -306,31 +313,34 @@
|
||||
[invocation setArgument:&relaunch atIndex:2];
|
||||
[invocation setTarget:self];
|
||||
postponedOnce = YES;
|
||||
if ([[updater delegate] updater:updater shouldPostponeRelaunchForUpdate:updateItem untilInvoking:invocation])
|
||||
if ([[updater delegate] updater:updater shouldPostponeRelaunchForUpdate:updateItem untilInvoking:invocation]) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ([[updater delegate] respondsToSelector:@selector(updater:willInstallUpdate:)])
|
||||
if ([[updater delegate] respondsToSelector:@selector(updater:willInstallUpdate:)]) {
|
||||
[[updater delegate] updater:updater willInstallUpdate:updateItem];
|
||||
|
||||
// Copy the relauncher into a temporary directory so we can get to it after the new version's installed.
|
||||
NSString *relaunchPathToCopy = [SPARKLE_BUNDLE pathForResource:@"finish_installation" ofType:@"app"];
|
||||
NSString *targetPath = [[host appSupportPath] stringByAppendingPathComponent:[relaunchPathToCopy lastPathComponent]];
|
||||
// Only the paranoid survive: if there's already a stray copy of relaunch there, we would have problems.
|
||||
NSError *error = nil;
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4
|
||||
[[NSFileManager defaultManager] createDirectoryAtPath: [targetPath stringByDeletingLastPathComponent] attributes: [NSDictionary dictionary]];
|
||||
#else
|
||||
[[NSFileManager defaultManager] createDirectoryAtPath: [targetPath stringByDeletingLastPathComponent] withIntermediateDirectories: YES attributes: [NSDictionary dictionary] error: &error];
|
||||
#endif
|
||||
}
|
||||
|
||||
NSString *const finishInstallToolName = FINISH_INSTALL_TOOL_NAME_STRING;
|
||||
|
||||
// Copy the relauncher into a temporary directory so we can get to it after the new version's installed.
|
||||
// Only the paranoid survive: if there's already a stray copy of relaunch there, we would have problems.
|
||||
if( [SUPlainInstaller copyPathWithAuthentication: relaunchPathToCopy overPath: targetPath temporaryName: nil error: &error] )
|
||||
relaunchPath = [targetPath retain];
|
||||
else
|
||||
[self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SURelaunchError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:SULocalizedString(@"An error occurred while extracting the archive. Please try again later.", nil), NSLocalizedDescriptionKey, [NSString stringWithFormat:@"Couldn't copy relauncher (%@) to temporary path (%@)! %@", relaunchPathToCopy, targetPath, (error ? [error localizedDescription] : @"")], NSLocalizedFailureReasonErrorKey, nil]]];
|
||||
|
||||
NSString *relaunchPathToCopy = [SPARKLE_BUNDLE pathForResource:finishInstallToolName ofType:@"app"];
|
||||
if (relaunchPathToCopy != nil)
|
||||
{
|
||||
NSString *targetPath = [[host appSupportPath] stringByAppendingPathComponent:[relaunchPathToCopy lastPathComponent]];
|
||||
// Only the paranoid survive: if there's already a stray copy of relaunch there, we would have problems.
|
||||
NSError *error = nil;
|
||||
[[NSFileManager defaultManager] createDirectoryAtPath: [targetPath stringByDeletingLastPathComponent] withIntermediateDirectories: YES attributes: @{} error: &error];
|
||||
|
||||
if( [SUPlainInstaller copyPathWithAuthentication: relaunchPathToCopy overPath: targetPath temporaryName: nil error: &error] )
|
||||
relaunchPath = [targetPath retain];
|
||||
else
|
||||
[self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SURelaunchError userInfo:@{NSLocalizedDescriptionKey: SULocalizedString(@"An error occurred while extracting the archive. Please try again later.", nil), NSLocalizedFailureReasonErrorKey: [NSString stringWithFormat:@"Couldn't copy relauncher (%@) to temporary path (%@)! %@", relaunchPathToCopy, targetPath, (error ? [error localizedDescription] : @"")]}]];
|
||||
}
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:SUUpdaterWillRestartNotification object:self];
|
||||
if ([[updater delegate] respondsToSelector:@selector(updaterWillRelaunchApplication:)])
|
||||
[[updater delegate] updaterWillRelaunchApplication:updater];
|
||||
@@ -338,16 +348,22 @@
|
||||
if(!relaunchPath || ![[NSFileManager defaultManager] fileExistsAtPath:relaunchPath])
|
||||
{
|
||||
// Note that we explicitly use the host app's name here, since updating plugin for Mail relaunches Mail, not just the plugin.
|
||||
[self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SURelaunchError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:SULocalizedString(@"An error occurred while relaunching %1$@, but the new version will be available next time you run %1$@.", nil), [host name]], NSLocalizedDescriptionKey, [NSString stringWithFormat:@"Couldn't find the relauncher (expected to find it at %@)", relaunchPath], NSLocalizedFailureReasonErrorKey, nil]]];
|
||||
[self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SURelaunchError userInfo:@{NSLocalizedDescriptionKey: [NSString stringWithFormat:SULocalizedString(@"An error occurred while relaunching %1$@, but the new version will be available next time you run %1$@.", nil), [host name]], NSLocalizedFailureReasonErrorKey: [NSString stringWithFormat:@"Couldn't find the relauncher (expected to find it at %@)", relaunchPath]}]];
|
||||
// We intentionally don't abandon the update here so that the host won't initiate another.
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
NSString *pathToRelaunch = [host bundlePath];
|
||||
if ([[updater delegate] respondsToSelector:@selector(pathToRelaunchForUpdater:)])
|
||||
if ([[updater delegate] respondsToSelector:@selector(pathToRelaunchForUpdater:)]) {
|
||||
pathToRelaunch = [[updater delegate] pathToRelaunchForUpdater:updater];
|
||||
NSString *relaunchToolPath = [relaunchPath stringByAppendingPathComponent: @"/Contents/MacOS/finish_installation"];
|
||||
[NSTask launchedTaskWithLaunchPath: relaunchToolPath arguments:[NSArray arrayWithObjects:[host bundlePath], pathToRelaunch, [NSString stringWithFormat:@"%d", [[NSProcessInfo processInfo] processIdentifier]], tempDir, relaunch ? @"1" : @"0", nil]];
|
||||
}
|
||||
NSString *relaunchToolPath = [[relaunchPath stringByAppendingPathComponent: @"/Contents/MacOS"] stringByAppendingPathComponent: finishInstallToolName];
|
||||
[NSTask launchedTaskWithLaunchPath: relaunchToolPath arguments:@[[host bundlePath],
|
||||
pathToRelaunch,
|
||||
[NSString stringWithFormat:@"%d", [[NSProcessInfo processInfo] processIdentifier]],
|
||||
tempDir,
|
||||
relaunch ? @"1" : @"0",
|
||||
showUI ? @"1" : @"0"]];
|
||||
|
||||
[NSApp terminate:self];
|
||||
}
|
||||
@@ -357,27 +373,19 @@
|
||||
if (tempDir != nil) // tempDir contains downloadPath, so we implicitly delete both here.
|
||||
{
|
||||
BOOL success = NO;
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4
|
||||
success = [[NSFileManager defaultManager] removeFileAtPath: tempDir handler: nil]; // Clean up the copied relauncher
|
||||
#else
|
||||
NSError * error = nil;
|
||||
success = [[NSFileManager defaultManager] removeItemAtPath: tempDir error: &error]; // Clean up the copied relauncher
|
||||
#endif
|
||||
if( !success )
|
||||
[[NSWorkspace sharedWorkspace] performFileOperation:NSWorkspaceRecycleOperation source:[tempDir stringByDeletingLastPathComponent] destination:@"" files:[NSArray arrayWithObject:[tempDir lastPathComponent]] tag:NULL];
|
||||
[[NSWorkspace sharedWorkspace] performFileOperation:NSWorkspaceRecycleOperation source:[tempDir stringByDeletingLastPathComponent] destination:@"" files:@[[tempDir lastPathComponent]] tag:NULL];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)installerForHost:(SUHost *)aHost failedWithError:(NSError *)error
|
||||
{
|
||||
if (aHost != host) { return; }
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4
|
||||
[[NSFileManager defaultManager] removeFileAtPath: relaunchPath handler: nil]; // Clean up the copied relauncher
|
||||
#else
|
||||
NSError * dontThrow = nil;
|
||||
[[NSFileManager defaultManager] removeItemAtPath: relaunchPath error: &dontThrow]; // Clean up the copied relauncher
|
||||
#endif
|
||||
[self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:SULocalizedString(@"An error occurred while installing the update. Please try again later.", nil), NSLocalizedDescriptionKey, [error localizedDescription], NSLocalizedFailureReasonErrorKey, nil]]];
|
||||
[self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{NSLocalizedDescriptionKey: SULocalizedString(@"An error occurred while installing the update. Please try again later.", nil), NSLocalizedFailureReasonErrorKey: [error localizedDescription]}]];
|
||||
}
|
||||
|
||||
- (void)abortUpdate
|
||||
@@ -390,12 +398,15 @@
|
||||
|
||||
- (void)abortUpdateWithError:(NSError *)error
|
||||
{
|
||||
if ([error code] != SUNoUpdateError) // Let's not bother logging this.
|
||||
if ([error code] != SUNoUpdateError) { // Let's not bother logging this.
|
||||
SULog(@"Sparkle Error: %@", [error localizedDescription]);
|
||||
if ([error localizedFailureReason])
|
||||
}
|
||||
if ([error localizedFailureReason]) {
|
||||
SULog(@"Sparkle Error (continued): %@", [error localizedFailureReason]);
|
||||
if (download)
|
||||
}
|
||||
if (download) {
|
||||
[download cancel];
|
||||
}
|
||||
[self abortUpdate];
|
||||
}
|
||||
|
||||
|
||||
@@ -8,12 +8,12 @@
|
||||
|
||||
#import "SUBinaryDeltaApply.h"
|
||||
#import "SUBinaryDeltaCommon.h"
|
||||
#import <CommonCrypto/CommonDigest.h>
|
||||
#include <CommonCrypto/CommonDigest.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <bspatch.h>
|
||||
#import <stdio.h>
|
||||
#import <stdlib.h>
|
||||
#import <xar/xar.h>
|
||||
#include <bspatch.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <xar/xar.h>
|
||||
|
||||
static void applyBinaryDeltaToFile(xar_t x, xar_file_t file, NSString *sourceFilePath, NSString *destinationFilePath)
|
||||
{
|
||||
@@ -40,11 +40,11 @@ int applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFil
|
||||
const char *value = 0;
|
||||
xar_subdoc_prop_get(subdoc, "before-sha1", &value);
|
||||
if (value)
|
||||
expectedBeforeHash = [NSString stringWithUTF8String:value];
|
||||
expectedBeforeHash = @(value);
|
||||
|
||||
xar_subdoc_prop_get(subdoc, "after-sha1", &value);
|
||||
if (value)
|
||||
expectedAfterHash = [NSString stringWithUTF8String:value];
|
||||
expectedAfterHash = @(value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ int applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFil
|
||||
xar_file_t file;
|
||||
xar_iter_t iter = xar_iter_new();
|
||||
for (file = xar_file_first(x, iter); file; file = xar_file_next(iter)) {
|
||||
NSString *path = [NSString stringWithUTF8String:xar_get_path(file)];
|
||||
NSString *path = @(xar_get_path(file));
|
||||
NSString *sourceFilePath = [source stringByAppendingPathComponent:path];
|
||||
NSString *destinationFilePath = [destination stringByAppendingPathComponent:path];
|
||||
|
||||
|
||||
@@ -22,5 +22,5 @@ extern void removeTree(NSString *path);
|
||||
extern void copyTree(NSString *source, NSString *dest);
|
||||
extern NSString *pathRelativeToDirectory(NSString *directory, NSString *path);
|
||||
NSString *temporaryFilename(NSString *base);
|
||||
|
||||
NSString *stringWithFileSystemRepresentation(const char*);
|
||||
#endif
|
||||
+19
-20
@@ -15,8 +15,7 @@
|
||||
#include <sys/mman.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
extern int xar_close(void*) __attribute__((weak_import));
|
||||
#include <xar/xar.h>
|
||||
|
||||
int binaryDeltaSupported(void)
|
||||
{
|
||||
@@ -39,12 +38,20 @@ NSString *pathRelativeToDirectory(NSString *directory, NSString *path)
|
||||
return path;
|
||||
}
|
||||
|
||||
NSString *stringWithFileSystemRepresentation(const char *input) {
|
||||
NSFileManager *fm = [NSFileManager defaultManager];
|
||||
return [fm stringWithFileSystemRepresentation:input length:strlen(input)];
|
||||
}
|
||||
|
||||
NSString *temporaryFilename(NSString *base)
|
||||
{
|
||||
NSString *template = [NSTemporaryDirectory() stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.XXXXXXXXXX", base]];
|
||||
char buffer[MAXPATHLEN];
|
||||
strcpy(buffer, [template fileSystemRepresentation]);
|
||||
return [NSString stringWithUTF8String:mktemp(buffer)];
|
||||
const char *fsrepr = [template fileSystemRepresentation];
|
||||
char buffer[strlen(fsrepr)+1];
|
||||
strcpy(buffer, fsrepr);
|
||||
|
||||
// mkstemp() can't be used, beause it returns a file descriptor, and XAR API requires a filename
|
||||
return stringWithFileSystemRepresentation(mktemp(buffer));
|
||||
}
|
||||
|
||||
static void _hashOfBuffer(unsigned char *hash, const char* buffer, size_t bufferLength)
|
||||
@@ -110,7 +117,7 @@ NSData *hashOfFile(FTSENT *ent)
|
||||
|
||||
NSString *hashOfTree(NSString *path)
|
||||
{
|
||||
const char *sourcePaths[] = {[path UTF8String], 0};
|
||||
const char *sourcePaths[] = {[path fileSystemRepresentation], 0};
|
||||
FTS *fts = fts_open((char* const*)sourcePaths, FTS_PHYSICAL | FTS_NOCHDIR, compareFiles);
|
||||
if (!fts) {
|
||||
perror("fts_open");
|
||||
@@ -129,9 +136,9 @@ NSString *hashOfTree(NSString *path)
|
||||
_hashOfFile(fileHash, ent);
|
||||
CC_SHA1_Update(&hashContext, fileHash, sizeof(fileHash));
|
||||
|
||||
NSString *relativePath = pathRelativeToDirectory(path, [NSString stringWithUTF8String:ent->fts_path]);
|
||||
NSData *relativePathBytes = [relativePath dataUsingEncoding:NSUTF8StringEncoding];
|
||||
CC_SHA1_Update(&hashContext, [relativePathBytes bytes], (uint32_t)[relativePathBytes length]);
|
||||
NSString *relativePath = pathRelativeToDirectory(path, stringWithFileSystemRepresentation(ent->fts_path));
|
||||
const char *relativePathBytes = [relativePath fileSystemRepresentation];
|
||||
CC_SHA1_Update(&hashContext, relativePathBytes, (CC_LONG)strlen(relativePathBytes));
|
||||
}
|
||||
fts_close(fts);
|
||||
|
||||
@@ -143,23 +150,15 @@ NSString *hashOfTree(NSString *path)
|
||||
for (i = 0; i < CC_SHA1_DIGEST_LENGTH; i++)
|
||||
sprintf(hexHash + i * 2, "%02x", hash[i]);
|
||||
|
||||
return [NSString stringWithUTF8String:hexHash];
|
||||
return @(hexHash);
|
||||
}
|
||||
|
||||
void removeTree(NSString *path)
|
||||
{
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_4
|
||||
[[NSFileManager defaultManager] removeItemAtPath:path error:0];
|
||||
#else
|
||||
[[NSFileManager defaultManager] removeFileAtPath:path handler:nil];
|
||||
#endif
|
||||
[[NSFileManager defaultManager] removeItemAtPath:path error:nil];
|
||||
}
|
||||
|
||||
void copyTree(NSString *source, NSString *dest)
|
||||
{
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_4
|
||||
[[NSFileManager defaultManager] copyItemAtPath:source toPath:dest error:0];
|
||||
#else
|
||||
[[NSFileManager defaultManager] copyPath:source toPath:dest handler:nil];
|
||||
#endif
|
||||
[[NSFileManager defaultManager] copyItemAtPath:source toPath:dest error:nil];
|
||||
}
|
||||
+180
-171
@@ -25,47 +25,44 @@
|
||||
extern int bsdiff(int argc, const char **argv);
|
||||
|
||||
@interface CreateBinaryDeltaOperation : NSOperation
|
||||
{
|
||||
NSString *_relativePath;
|
||||
NSString *_fromPath;
|
||||
NSString *_toPath;
|
||||
NSString *_resultPath;
|
||||
}
|
||||
@property (copy) NSString *relativePath;
|
||||
@property (retain) NSString *resultPath;
|
||||
@property (retain) NSString *_fromPath;
|
||||
@property (retain) NSString *_toPath;
|
||||
- (id)initWithRelativePath:(NSString *)relativePath oldTree:(NSString *)oldTree newTree:(NSString *)newTree;
|
||||
|
||||
- (NSString *)relativePath;
|
||||
- (NSString *)resultPath;
|
||||
@end
|
||||
|
||||
@implementation CreateBinaryDeltaOperation
|
||||
@synthesize _fromPath = _fromPath;
|
||||
@synthesize _toPath = _toPath;
|
||||
|
||||
- (id)initWithRelativePath:(NSString *)relativePath oldTree:(NSString *)oldTree newTree:(NSString *)newTree
|
||||
{
|
||||
if ((self = [super init])) {
|
||||
_relativePath = [relativePath copy];
|
||||
_fromPath = [[oldTree stringByAppendingPathComponent:relativePath] retain];
|
||||
_toPath = [[newTree stringByAppendingPathComponent:relativePath] retain];
|
||||
self.relativePath = relativePath;
|
||||
self._fromPath = [oldTree stringByAppendingPathComponent:relativePath];
|
||||
self._toPath = [newTree stringByAppendingPathComponent:relativePath];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSString *)relativePath
|
||||
{
|
||||
return [[_relativePath retain] autorelease];
|
||||
}
|
||||
|
||||
- (NSString *)resultPath
|
||||
{
|
||||
return [[_resultPath retain] autorelease];
|
||||
}
|
||||
|
||||
- (void)main
|
||||
{
|
||||
NSString *temporaryFile = temporaryFilename(@"BinaryDelta");
|
||||
const char *argv[] = {"/usr/bin/bsdiff", [_fromPath fileSystemRepresentation], [_toPath fileSystemRepresentation], [temporaryFile fileSystemRepresentation]};
|
||||
int result = bsdiff(4, argv);
|
||||
if (!result)
|
||||
_resultPath = [temporaryFile retain];
|
||||
self.resultPath = temporaryFile;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
self.relativePath = nil;
|
||||
self.resultPath = nil;
|
||||
self._fromPath = nil;
|
||||
self._toPath = nil;
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -74,8 +71,9 @@ static NSDictionary *infoForFile(FTSENT *ent)
|
||||
{
|
||||
NSData *hash = hashOfFile(ent);
|
||||
NSNumber *size = nil;
|
||||
if (ent->fts_info != FTS_D)
|
||||
if (ent->fts_info != FTS_D) {
|
||||
size = [NSNumber numberWithUnsignedLongLong:ent->fts_statp->st_size];
|
||||
}
|
||||
return [NSDictionary dictionaryWithObjectsAndKeys:hash, @"hash", [NSNumber numberWithUnsignedShort:ent->fts_info], @"type", size, @"size", nil];
|
||||
}
|
||||
|
||||
@@ -96,174 +94,185 @@ static NSString *temporaryPatchFile(NSString *patchFile)
|
||||
static BOOL shouldSkipDeltaCompression(NSString *key, NSDictionary* originalInfo, NSDictionary *newInfo)
|
||||
{
|
||||
unsigned long long fileSize = [[newInfo objectForKey:@"size"] unsignedLongLongValue];
|
||||
if (fileSize < 4096)
|
||||
if (fileSize < 4096) {
|
||||
return YES;
|
||||
}
|
||||
|
||||
if (!originalInfo)
|
||||
if (!originalInfo) {
|
||||
return YES;
|
||||
}
|
||||
|
||||
if ([[originalInfo objectForKey:@"type"] unsignedShortValue] != [[newInfo objectForKey:@"type"] unsignedShortValue])
|
||||
if ([[originalInfo objectForKey:@"type"] unsignedShortValue] != [[newInfo objectForKey:@"type"] unsignedShortValue]) {
|
||||
return YES;
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
static BOOL shouldDeleteThenExtract(NSString *key, NSDictionary* originalInfo, NSDictionary *newInfo)
|
||||
{
|
||||
if (!originalInfo)
|
||||
if (!originalInfo) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
if ([[originalInfo objectForKey:@"type"] unsignedShortValue] != [[newInfo objectForKey:@"type"] unsignedShortValue])
|
||||
if ([[originalInfo objectForKey:@"type"] unsignedShortValue] != [[newInfo objectForKey:@"type"] unsignedShortValue]) {
|
||||
return YES;
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
if (argc != 5) {
|
||||
usage:
|
||||
fprintf(stderr, "Usage: BinaryDelta [create | apply] before-tree after-tree patch-file\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
NSString *command = [NSString stringWithUTF8String:argv[1]];
|
||||
NSString *oldPath = [NSString stringWithUTF8String:argv[2]];
|
||||
NSString *newPath = [NSString stringWithUTF8String:argv[3]];
|
||||
NSString *patchFile = [NSString stringWithUTF8String:argv[4]];
|
||||
|
||||
if ([command isEqualToString:@"apply"]) {
|
||||
int result = applyBinaryDelta(oldPath, newPath, patchFile);
|
||||
[pool drain];
|
||||
return result;
|
||||
}
|
||||
if (![command isEqualToString:@"create"]) {
|
||||
[pool drain];
|
||||
goto usage;
|
||||
}
|
||||
|
||||
NSMutableDictionary *originalTreeState = [NSMutableDictionary dictionary];
|
||||
|
||||
const char *sourcePaths[] = {[oldPath fileSystemRepresentation], 0};
|
||||
FTS *fts = fts_open((char* const*)sourcePaths, FTS_PHYSICAL | FTS_NOCHDIR, compareFiles);
|
||||
if (!fts) {
|
||||
[pool drain];
|
||||
perror("fts_open");
|
||||
return 1;
|
||||
}
|
||||
|
||||
fprintf(stderr, "Processing %s...", [oldPath UTF8String]);
|
||||
FTSENT *ent = 0;
|
||||
while ((ent = fts_read(fts))) {
|
||||
if (ent->fts_info != FTS_F && ent->fts_info != FTS_SL && ent->fts_info != FTS_D)
|
||||
continue;
|
||||
|
||||
NSString *key = pathRelativeToDirectory(oldPath, [NSString stringWithUTF8String:ent->fts_path]);
|
||||
if (![key length])
|
||||
continue;
|
||||
|
||||
NSDictionary *info = infoForFile(ent);
|
||||
[originalTreeState setObject:info forKey:key];
|
||||
}
|
||||
fts_close(fts);
|
||||
|
||||
NSString *beforeHash = hashOfTree(oldPath);
|
||||
|
||||
NSMutableDictionary *newTreeState = [NSMutableDictionary dictionary];
|
||||
for (NSString *key in originalTreeState)
|
||||
{
|
||||
[newTreeState setObject:[NSNull null] forKey:key];
|
||||
}
|
||||
|
||||
fprintf(stderr, "\nProcessing %s... ", [newPath UTF8String]);
|
||||
sourcePaths[0] = [newPath fileSystemRepresentation];
|
||||
fts = fts_open((char* const*)sourcePaths, FTS_PHYSICAL | FTS_NOCHDIR, compareFiles);
|
||||
if (!fts) {
|
||||
[pool drain];
|
||||
perror("fts_open");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
while ((ent = fts_read(fts))) {
|
||||
if (ent->fts_info != FTS_F && ent->fts_info != FTS_SL && ent->fts_info != FTS_D)
|
||||
continue;
|
||||
|
||||
NSString *key = pathRelativeToDirectory(newPath, [NSString stringWithUTF8String:ent->fts_path]);
|
||||
if (![key length])
|
||||
continue;
|
||||
|
||||
NSDictionary *info = infoForFile(ent);
|
||||
NSDictionary *oldInfo = [originalTreeState objectForKey:key];
|
||||
|
||||
if ([info isEqual:oldInfo])
|
||||
[newTreeState removeObjectForKey:key];
|
||||
else
|
||||
[newTreeState setObject:info forKey:key];
|
||||
}
|
||||
fts_close(fts);
|
||||
|
||||
NSString *afterHash = hashOfTree(newPath);
|
||||
|
||||
fprintf(stderr, "\nGenerating delta... ");
|
||||
|
||||
NSString *temporaryFile = temporaryPatchFile(patchFile);
|
||||
xar_t x = xar_open([temporaryFile fileSystemRepresentation], WRITE);
|
||||
xar_opt_set(x, XAR_OPT_COMPRESSION, "bzip2");
|
||||
xar_subdoc_t attributes = xar_subdoc_new(x, "binary-delta-attributes");
|
||||
xar_subdoc_prop_set(attributes, "before-sha1", [beforeHash UTF8String]);
|
||||
xar_subdoc_prop_set(attributes, "after-sha1", [afterHash UTF8String]);
|
||||
|
||||
NSOperationQueue *deltaQueue = [[NSOperationQueue alloc] init];
|
||||
NSMutableArray *deltaOperations = [NSMutableArray array];
|
||||
|
||||
NSArray *keys = [[newTreeState allKeys] sortedArrayUsingSelector:@selector(compare:)];
|
||||
for (NSString* key in keys) {
|
||||
id value = [newTreeState valueForKey:key];
|
||||
|
||||
if ([value isEqual:[NSNull null]]) {
|
||||
xar_file_t newFile = xar_add_frombuffer(x, 0, [key fileSystemRepresentation], (char *)"", 1);
|
||||
assert(newFile);
|
||||
xar_prop_set(newFile, "delete", "true");
|
||||
continue;
|
||||
@autoreleasepool {
|
||||
if (argc != 5) {
|
||||
usage:
|
||||
fprintf(stderr, "Usage: BinaryDelta [create | apply] before-tree after-tree patch-file\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
NSDictionary *originalInfo = [originalTreeState objectForKey:key];
|
||||
NSDictionary *newInfo = [newTreeState objectForKey:key];
|
||||
if (shouldSkipDeltaCompression(key, originalInfo, newInfo)) {
|
||||
NSString *path = [newPath stringByAppendingPathComponent:key];
|
||||
xar_file_t newFile = xar_add_frompath(x, 0, [key fileSystemRepresentation], [path fileSystemRepresentation]);
|
||||
assert(newFile);
|
||||
if (shouldDeleteThenExtract(key, originalInfo, newInfo))
|
||||
xar_prop_set(newFile, "delete-then-extract", "true");
|
||||
} else {
|
||||
CreateBinaryDeltaOperation *operation = [[CreateBinaryDeltaOperation alloc] initWithRelativePath:key oldTree:oldPath newTree:newPath];
|
||||
[deltaQueue addOperation:operation];
|
||||
[deltaOperations addObject:operation];
|
||||
[operation release];
|
||||
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
NSString *command = [NSString stringWithUTF8String:argv[1]];
|
||||
NSString *oldPath = stringWithFileSystemRepresentation(argv[2]);
|
||||
NSString *newPath = stringWithFileSystemRepresentation(argv[3]);
|
||||
NSString *patchFile = stringWithFileSystemRepresentation(argv[4]);
|
||||
|
||||
if ([command isEqualToString:@"apply"]) {
|
||||
int result = applyBinaryDelta(oldPath, newPath, patchFile);
|
||||
[pool drain];
|
||||
return result;
|
||||
}
|
||||
if (![command isEqualToString:@"create"]) {
|
||||
[pool drain];
|
||||
goto usage;
|
||||
}
|
||||
|
||||
NSMutableDictionary *originalTreeState = [NSMutableDictionary dictionary];
|
||||
|
||||
const char *sourcePaths[] = {[oldPath fileSystemRepresentation], 0};
|
||||
FTS *fts = fts_open((char* const*)sourcePaths, FTS_PHYSICAL | FTS_NOCHDIR, compareFiles);
|
||||
if (!fts) {
|
||||
[pool drain];
|
||||
perror("fts_open");
|
||||
return 1;
|
||||
}
|
||||
|
||||
fprintf(stderr, "Processing %s...", [oldPath UTF8String]);
|
||||
FTSENT *ent = 0;
|
||||
while ((ent = fts_read(fts))) {
|
||||
if (ent->fts_info != FTS_F && ent->fts_info != FTS_SL && ent->fts_info != FTS_D) {
|
||||
continue;
|
||||
}
|
||||
|
||||
NSString *key = pathRelativeToDirectory(oldPath, stringWithFileSystemRepresentation(ent->fts_path));
|
||||
if (![key length]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
NSDictionary *info = infoForFile(ent);
|
||||
[originalTreeState setObject:info forKey:key];
|
||||
}
|
||||
fts_close(fts);
|
||||
|
||||
NSString *beforeHash = hashOfTree(oldPath);
|
||||
|
||||
NSMutableDictionary *newTreeState = [NSMutableDictionary dictionary];
|
||||
for (NSString *key in originalTreeState)
|
||||
{
|
||||
[newTreeState setObject:[NSNull null] forKey:key];
|
||||
}
|
||||
|
||||
fprintf(stderr, "\nProcessing %s... ", [newPath UTF8String]);
|
||||
sourcePaths[0] = [newPath fileSystemRepresentation];
|
||||
fts = fts_open((char* const*)sourcePaths, FTS_PHYSICAL | FTS_NOCHDIR, compareFiles);
|
||||
if (!fts) {
|
||||
[pool drain];
|
||||
perror("fts_open");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
while ((ent = fts_read(fts))) {
|
||||
if (ent->fts_info != FTS_F && ent->fts_info != FTS_SL && ent->fts_info != FTS_D) {
|
||||
continue;
|
||||
}
|
||||
|
||||
NSString *key = pathRelativeToDirectory(newPath, stringWithFileSystemRepresentation(ent->fts_path));
|
||||
if (![key length]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
NSDictionary *info = infoForFile(ent);
|
||||
NSDictionary *oldInfo = [originalTreeState objectForKey:key];
|
||||
|
||||
if ([info isEqual:oldInfo])
|
||||
[newTreeState removeObjectForKey:key];
|
||||
else
|
||||
[newTreeState setObject:info forKey:key];
|
||||
}
|
||||
fts_close(fts);
|
||||
|
||||
NSString *afterHash = hashOfTree(newPath);
|
||||
|
||||
fprintf(stderr, "\nGenerating delta... ");
|
||||
|
||||
NSString *temporaryFile = temporaryPatchFile(patchFile);
|
||||
xar_t x = xar_open([temporaryFile fileSystemRepresentation], WRITE);
|
||||
xar_opt_set(x, XAR_OPT_COMPRESSION, "bzip2");
|
||||
xar_subdoc_t attributes = xar_subdoc_new(x, "binary-delta-attributes");
|
||||
xar_subdoc_prop_set(attributes, "before-sha1", [beforeHash UTF8String]);
|
||||
xar_subdoc_prop_set(attributes, "after-sha1", [afterHash UTF8String]);
|
||||
|
||||
NSOperationQueue *deltaQueue = [[NSOperationQueue alloc] init];
|
||||
NSMutableArray *deltaOperations = [NSMutableArray array];
|
||||
|
||||
NSArray *keys = [[newTreeState allKeys] sortedArrayUsingSelector:@selector(compare:)];
|
||||
for (NSString* key in keys) {
|
||||
id value = [newTreeState valueForKey:key];
|
||||
|
||||
if ([value isEqual:[NSNull null]]) {
|
||||
xar_file_t newFile = xar_add_frombuffer(x, 0, [key fileSystemRepresentation], (char *)"", 1);
|
||||
assert(newFile);
|
||||
xar_prop_set(newFile, "delete", "true");
|
||||
continue;
|
||||
}
|
||||
|
||||
NSDictionary *originalInfo = [originalTreeState objectForKey:key];
|
||||
NSDictionary *newInfo = [newTreeState objectForKey:key];
|
||||
if (shouldSkipDeltaCompression(key, originalInfo, newInfo)) {
|
||||
NSString *path = [newPath stringByAppendingPathComponent:key];
|
||||
xar_file_t newFile = xar_add_frompath(x, 0, [key fileSystemRepresentation], [path fileSystemRepresentation]);
|
||||
assert(newFile);
|
||||
if (shouldDeleteThenExtract(key, originalInfo, newInfo)) {
|
||||
xar_prop_set(newFile, "delete-then-extract", "true");
|
||||
}
|
||||
} else {
|
||||
CreateBinaryDeltaOperation *operation = [[CreateBinaryDeltaOperation alloc] initWithRelativePath:key oldTree:oldPath newTree:newPath];
|
||||
[deltaQueue addOperation:operation];
|
||||
[deltaOperations addObject:operation];
|
||||
[operation release];
|
||||
}
|
||||
}
|
||||
|
||||
[deltaQueue waitUntilAllOperationsAreFinished];
|
||||
[deltaQueue release];
|
||||
|
||||
for (CreateBinaryDeltaOperation *operation in deltaOperations) {
|
||||
NSString *resultPath = [operation resultPath];
|
||||
xar_file_t newFile = xar_add_frompath(x, 0, [[operation relativePath] fileSystemRepresentation], [resultPath fileSystemRepresentation]);
|
||||
assert(newFile);
|
||||
xar_prop_set(newFile, "binary-delta", "true");
|
||||
unlink([resultPath fileSystemRepresentation]);
|
||||
}
|
||||
|
||||
xar_close(x);
|
||||
|
||||
unlink([patchFile fileSystemRepresentation]);
|
||||
link([temporaryFile fileSystemRepresentation], [patchFile fileSystemRepresentation]);
|
||||
unlink([temporaryFile fileSystemRepresentation]);
|
||||
fprintf(stderr, "Done!\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
[deltaQueue waitUntilAllOperationsAreFinished];
|
||||
[deltaQueue release];
|
||||
|
||||
for (CreateBinaryDeltaOperation *operation in deltaOperations) {
|
||||
NSString *resultPath = [operation resultPath];
|
||||
xar_file_t newFile = xar_add_frompath(x, 0, [[operation relativePath] fileSystemRepresentation], [resultPath fileSystemRepresentation]);
|
||||
assert(newFile);
|
||||
xar_prop_set(newFile, "binary-delta", "true");
|
||||
unlink([resultPath fileSystemRepresentation]);
|
||||
}
|
||||
|
||||
xar_close(x);
|
||||
|
||||
unlink([patchFile fileSystemRepresentation]);
|
||||
link([temporaryFile fileSystemRepresentation], [patchFile fileSystemRepresentation]);
|
||||
unlink([temporaryFile fileSystemRepresentation]);
|
||||
fprintf(stderr, "Done!\n");
|
||||
|
||||
[pool drain];
|
||||
return 0;
|
||||
}
|
||||
@@ -12,8 +12,7 @@
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "SUUnarchiver.h"
|
||||
|
||||
@interface SUBinaryDeltaUnarchiver : SUUnarchiver {
|
||||
}
|
||||
@interface SUBinaryDeltaUnarchiver : SUUnarchiver
|
||||
|
||||
@end
|
||||
|
||||
|
||||
+19
-12
@@ -22,22 +22,29 @@
|
||||
|
||||
- (void)applyBinaryDelta
|
||||
{
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
NSString *sourcePath = [[updateHost bundle] bundlePath];
|
||||
NSString *targetPath = [[archivePath stringByDeletingLastPathComponent] stringByAppendingPathComponent:[sourcePath lastPathComponent]];
|
||||
|
||||
int result = applyBinaryDelta(sourcePath, targetPath, archivePath);
|
||||
if (!result)
|
||||
[self performSelectorOnMainThread:@selector(notifyDelegateOfSuccess) withObject:nil waitUntilDone:NO];
|
||||
else
|
||||
[self performSelectorOnMainThread:@selector(notifyDelegateOfFailure) withObject:nil waitUntilDone:NO];
|
||||
|
||||
[pool drain];
|
||||
@autoreleasepool {
|
||||
NSString *sourcePath = [[updateHost bundle] bundlePath];
|
||||
NSString *targetPath = [[archivePath stringByDeletingLastPathComponent] stringByAppendingPathComponent:[sourcePath lastPathComponent]];
|
||||
|
||||
int result = applyBinaryDelta(sourcePath, targetPath, archivePath);
|
||||
if (!result) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self notifyDelegateOfSuccess];
|
||||
});
|
||||
}
|
||||
else {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self notifyDelegateOfFailure];
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)start
|
||||
{
|
||||
[NSThread detachNewThreadSelector:@selector(applyBinaryDelta) toTarget:self withObject:nil];
|
||||
dispatch_async(dispatch_get_global_queue(0, 0), ^{
|
||||
[self applyBinaryDelta];
|
||||
});
|
||||
}
|
||||
|
||||
+ (void)load
|
||||
|
||||
+2
-16
@@ -6,26 +6,15 @@
|
||||
//
|
||||
//
|
||||
|
||||
#import <Security/CodeSigning.h>
|
||||
#include <Security/CodeSigning.h>
|
||||
#include <Security/SecCode.h>
|
||||
#import "SUCodeSigningVerifier.h"
|
||||
#import "SULog.h"
|
||||
|
||||
@implementation SUCodeSigningVerifier
|
||||
|
||||
extern OSStatus SecCodeCopySelf(SecCSFlags flags, SecCodeRef *self) __attribute__((weak_import));
|
||||
|
||||
extern OSStatus SecCodeCopyDesignatedRequirement(SecStaticCodeRef code, SecCSFlags flags, SecRequirementRef *requirement) __attribute__((weak_import));
|
||||
|
||||
extern OSStatus SecStaticCodeCreateWithPath(CFURLRef path, SecCSFlags flags, SecStaticCodeRef *staticCode) __attribute__((weak_import));
|
||||
|
||||
extern OSStatus SecStaticCodeCheckValidityWithErrors(SecStaticCodeRef staticCode, SecCSFlags flags, SecRequirementRef requirement, CFErrorRef *errors) __attribute__((weak_import));
|
||||
|
||||
|
||||
+ (BOOL)codeSignatureIsValidAtPath:(NSString *)destinationPath error:(NSError **)error
|
||||
{
|
||||
// This API didn't exist prior to 10.6.
|
||||
if (SecCodeCopySelf == NULL) return NO;
|
||||
|
||||
OSStatus result;
|
||||
SecRequirementRef requirement = NULL;
|
||||
SecStaticCodeRef staticCode = NULL;
|
||||
@@ -68,9 +57,6 @@ finally:
|
||||
|
||||
+ (BOOL)hostApplicationIsCodeSigned
|
||||
{
|
||||
// This API didn't exist prior to 10.6.
|
||||
if (SecCodeCopySelf == NULL) return NO;
|
||||
|
||||
OSStatus result;
|
||||
SecCodeRef hostCode = NULL;
|
||||
result = SecCodeCopySelf(kSecCSDefaultFlags, &hostCode);
|
||||
|
||||
@@ -33,8 +33,6 @@
|
||||
// Notifications:
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
extern NSString *const SUUpdaterWillRestartNotification;
|
||||
|
||||
extern NSString *const SUTechnicalErrorInformationKey;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@@ -88,26 +86,4 @@ extern OSStatus SURelaunchError;
|
||||
extern OSStatus SUInstallationError;
|
||||
extern OSStatus SUDowngradeError;
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// NSInteger fixer-upper:
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
// NSInteger is a type that was added to Leopard.
|
||||
// Here is some glue to ensure that NSInteger will work with pre-10.5 SDKs:
|
||||
#ifndef NSINTEGER_DEFINED
|
||||
#ifdef NS_BUILD_32_LIKE_64
|
||||
typedef long NSInteger;
|
||||
typedef unsigned long NSUInteger;
|
||||
#else
|
||||
typedef int NSInteger;
|
||||
typedef unsigned int NSUInteger;
|
||||
#endif
|
||||
#define NSIntegerMax LONG_MAX
|
||||
#define NSIntegerMin LONG_MIN
|
||||
#define NSUIntegerMax ULONG_MAX
|
||||
#define NSINTEGER_DEFINED 1
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
@@ -13,7 +13,6 @@
|
||||
#import "SUVersionComparisonProtocol.h"
|
||||
#import "SUConstants.h"
|
||||
|
||||
NSString *const SUUpdaterWillRestartNotification = @"SUUpdaterWillRestartNotificationName";
|
||||
NSString *const SUTechnicalErrorInformationKey = @"SUTechnicalErrorInformation";
|
||||
|
||||
NSString *const SUHasLaunchedBeforeKey = @"SUHasLaunchedBefore";
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@interface SUDSAVerifier : NSObject {}
|
||||
@interface SUDSAVerifier : NSObject
|
||||
+ (BOOL)validatePath:(NSString *)path withEncodedDSASignature:(NSString *)encodedSignature withPublicDSAKey:(NSString *)pkeyString;
|
||||
@end
|
||||
|
||||
|
||||
+2
-4
@@ -9,7 +9,7 @@
|
||||
#import "SUDSAVerifier.h"
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
#import <Security/cssm.h>
|
||||
#include <Security/cssm.h>
|
||||
|
||||
/* CDSA Specific */
|
||||
static CSSM_CSP_HANDLE cdsaInit( void );
|
||||
@@ -145,10 +145,8 @@ static NSData *rawKeyData( NSString *key )
|
||||
|
||||
// Remove whitespace around each line of the key.
|
||||
NSMutableArray *pkeyTrimmedLines = [NSMutableArray array];
|
||||
NSEnumerator *pkeyLinesEnumerator = [[t componentsSeparatedByString:@"\n"] objectEnumerator];
|
||||
NSCharacterSet *whiteSet = [NSCharacterSet whitespaceCharacterSet];
|
||||
NSString *pkeyLine;
|
||||
while ((pkeyLine = [pkeyLinesEnumerator nextObject]) != nil)
|
||||
for (NSString *pkeyLine in [t componentsSeparatedByString:@"\n"])
|
||||
{
|
||||
[pkeyTrimmedLines addObject:[pkeyLine stringByTrimmingCharactersInSet:whiteSet]];
|
||||
}
|
||||
|
||||
@@ -12,8 +12,7 @@
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "SUUnarchiver.h"
|
||||
|
||||
@interface SUDiskImageUnarchiver : SUUnarchiver {
|
||||
}
|
||||
@interface SUDiskImageUnarchiver : SUUnarchiver
|
||||
|
||||
@end
|
||||
|
||||
|
||||
+100
-144
@@ -10,7 +10,7 @@
|
||||
#import "SUUnarchiver_Private.h"
|
||||
#import "NTSynchronousTask.h"
|
||||
#import "SULog.h"
|
||||
#import <CoreServices/CoreServices.h>
|
||||
#include <CoreServices/CoreServices.h>
|
||||
|
||||
@implementation SUDiskImageUnarchiver
|
||||
|
||||
@@ -22,152 +22,121 @@
|
||||
// Called on a non-main thread.
|
||||
- (void)extractDMG
|
||||
{
|
||||
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
NSData *result = [NTSynchronousTask task:@"/usr/bin/hdiutil" directory:@"/" withArgs:[NSArray arrayWithObjects: @"isencrypted", archivePath, nil] input:NULL];
|
||||
if([self isEncrypted:result] && [delegate respondsToSelector:@selector(unarchiver:requiresPasswordReturnedViaInvocation:)]) {
|
||||
[self performSelectorOnMainThread:@selector(requestPasswordFromDelegate) withObject:nil waitUntilDone:NO];
|
||||
} else {
|
||||
[self extractDMGWithPassword:nil];
|
||||
}
|
||||
|
||||
[pool release];
|
||||
@autoreleasepool {
|
||||
[self extractDMGWithPassword:nil];
|
||||
}
|
||||
}
|
||||
|
||||
// Called on a non-main thread.
|
||||
- (void)extractDMGWithPassword:(NSString *)password
|
||||
{
|
||||
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
BOOL mountedSuccessfully = NO;
|
||||
|
||||
SULog(@"Extracting %@ as a DMG", archivePath);
|
||||
|
||||
// get a unique mount point path
|
||||
NSString *mountPointName = nil;
|
||||
NSString *mountPoint = nil;
|
||||
FSRef tmpRef;
|
||||
do
|
||||
{
|
||||
CFUUIDRef uuid = CFUUIDCreate(NULL);
|
||||
if (uuid)
|
||||
@autoreleasepool {
|
||||
BOOL mountedSuccessfully = NO;
|
||||
|
||||
SULog(@"Extracting %@ as a DMG", archivePath);
|
||||
|
||||
// get a unique mount point path
|
||||
NSString *mountPoint = nil;
|
||||
FSRef tmpRef;
|
||||
do
|
||||
{
|
||||
CFStringRef uuidString = CFUUIDCreateString(NULL, uuid);
|
||||
if (uuidString)
|
||||
// Using NSUUID would make creating UUIDs be done in Cocoa,
|
||||
// and thus managed under ARC. Sadly, the class is in 10.8 and later.
|
||||
CFUUIDRef uuid = CFUUIDCreate(NULL);
|
||||
if (uuid)
|
||||
{
|
||||
mountPoint = [@"/Volumes" stringByAppendingPathComponent:(NSString*)uuidString];
|
||||
CFRelease(uuidString);
|
||||
NSString *uuidString = CFBridgingRelease(CFUUIDCreateString(NULL, uuid));
|
||||
if (uuidString)
|
||||
{
|
||||
mountPoint = [@"/Volumes" stringByAppendingPathComponent:uuidString];
|
||||
}
|
||||
CFRelease(uuid);
|
||||
}
|
||||
CFRelease(uuid);
|
||||
}
|
||||
}
|
||||
while (noErr == FSPathMakeRefWithOptions((UInt8 *)[mountPoint fileSystemRepresentation], kFSPathMakeRefDoNotFollowLeafSymlink, &tmpRef, NULL));
|
||||
|
||||
NSData *promptData = nil;
|
||||
if (password) {
|
||||
NSString *data = [NSString stringWithFormat:@"%@\nyes\n", password];
|
||||
const char *bytes = [data cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
NSUInteger length = [data lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
|
||||
promptData = [NSData dataWithBytes:bytes length:length];
|
||||
}
|
||||
else
|
||||
while (noErr == FSPathMakeRefWithOptions((UInt8 *)[mountPoint fileSystemRepresentation], kFSPathMakeRefDoNotFollowLeafSymlink, &tmpRef, NULL));
|
||||
|
||||
NSData *promptData = nil;
|
||||
promptData = [NSData dataWithBytes:"yes\n" length:4];
|
||||
|
||||
NSArray* arguments = [NSArray arrayWithObjects:@"attach", archivePath, @"-mountpoint", mountPoint, /*@"-noverify",*/ @"-nobrowse", @"-noautoopen", nil];
|
||||
|
||||
NSData *output = nil;
|
||||
NSInteger taskResult = -1;
|
||||
@try
|
||||
{
|
||||
NTSynchronousTask* task = [[NTSynchronousTask alloc] init];
|
||||
|
||||
[task run:@"/usr/bin/hdiutil" directory:@"/" withArgs:arguments input:promptData];
|
||||
NSArray* arguments = @[@"attach", archivePath, @"-mountpoint", mountPoint, /*@"-noverify",*/ @"-nobrowse", @"-noautoopen"];
|
||||
|
||||
taskResult = [task result];
|
||||
output = [[[task output] copy] autorelease];
|
||||
[task release];
|
||||
}
|
||||
@catch (NSException *localException)
|
||||
{
|
||||
goto reportError;
|
||||
}
|
||||
|
||||
if (taskResult != 0)
|
||||
{
|
||||
NSString* resultStr = output ? [[[NSString alloc] initWithData: output encoding: NSUTF8StringEncoding] autorelease] : nil;
|
||||
if (password != nil && [resultStr rangeOfString:@"Authentication error"].location != NSNotFound && [delegate respondsToSelector:@selector(unarchiver:requiresPasswordReturnedViaInvocation:)]) {
|
||||
[self performSelectorOnMainThread:@selector(requestPasswordFromDelegate) withObject:nil waitUntilDone:NO];
|
||||
goto finally;
|
||||
} else {
|
||||
SULog( @"hdiutil failed with code: %d data: <<%@>>", taskResult, resultStr );
|
||||
goto reportError;
|
||||
}
|
||||
}
|
||||
mountedSuccessfully = YES;
|
||||
|
||||
// Now that we've mounted it, we need to copy out its contents.
|
||||
if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6) {
|
||||
// On 10.7 and later we don't want to use the File Manager API and instead want to use NSFileManager (fixes #827357).
|
||||
NSData *output = nil;
|
||||
NSInteger taskResult = -1;
|
||||
@try
|
||||
{
|
||||
NTSynchronousTask* task = [[NTSynchronousTask alloc] init];
|
||||
|
||||
[task run:@"/usr/bin/hdiutil" directory:@"/" withArgs:arguments input:promptData];
|
||||
|
||||
taskResult = [task result];
|
||||
output = [[[task output] copy] autorelease];
|
||||
[task release];
|
||||
}
|
||||
@catch (NSException *localException)
|
||||
{
|
||||
goto reportError;
|
||||
}
|
||||
|
||||
if (taskResult != 0)
|
||||
{
|
||||
NSString* resultStr = output ? [[[NSString alloc] initWithData: output encoding: NSUTF8StringEncoding] autorelease] : nil;
|
||||
SULog( @"hdiutil failed with code: %d data: <<%@>>", taskResult, resultStr );
|
||||
goto reportError;
|
||||
}
|
||||
mountedSuccessfully = YES;
|
||||
|
||||
// Now that we've mounted it, we need to copy out its contents.
|
||||
NSFileManager *manager = [[[NSFileManager alloc] init] autorelease];
|
||||
NSError *error = nil;
|
||||
NSArray *contents = [manager contentsOfDirectoryAtPath:mountPoint error:&error];
|
||||
if (error)
|
||||
{
|
||||
SULog(@"Couldn't enumerate contents of archive mounted at %@: %@", mountPoint, error);
|
||||
goto reportError;
|
||||
}
|
||||
|
||||
NSEnumerator *contentsEnumerator = [contents objectEnumerator];
|
||||
NSString *item;
|
||||
while ((item = [contentsEnumerator nextObject]))
|
||||
{
|
||||
NSString *fromPath = [mountPoint stringByAppendingPathComponent:item];
|
||||
NSString *toPath = [[archivePath stringByDeletingLastPathComponent] stringByAppendingPathComponent:item];
|
||||
|
||||
// We skip any files in the DMG which are not readable.
|
||||
if (![manager isReadableFileAtPath:fromPath])
|
||||
continue;
|
||||
|
||||
SULog(@"copyItemAtPath:%@ toPath:%@", fromPath, toPath);
|
||||
|
||||
if (![manager copyItemAtPath:fromPath toPath:toPath error:&error])
|
||||
{
|
||||
SULog(@"Couldn't copy item: %@ : %@", error, error.userInfo ? error.userInfo : @"");
|
||||
goto reportError;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
FSRef srcRef, dstRef;
|
||||
OSStatus err;
|
||||
err = FSPathMakeRef((UInt8 *)[mountPoint fileSystemRepresentation], &srcRef, NULL);
|
||||
if (err != noErr) goto reportError;
|
||||
err = FSPathMakeRef((UInt8 *)[[archivePath stringByDeletingLastPathComponent] fileSystemRepresentation], &dstRef, NULL);
|
||||
if (err != noErr) goto reportError;
|
||||
NSError *error = nil;
|
||||
NSArray *contents = [manager contentsOfDirectoryAtPath:mountPoint error:&error];
|
||||
if (error)
|
||||
{
|
||||
SULog(@"Couldn't enumerate contents of archive mounted at %@: %@", mountPoint, error);
|
||||
goto reportError;
|
||||
}
|
||||
|
||||
err = FSCopyObjectSync(&srcRef, &dstRef, (CFStringRef)mountPointName, NULL, kFSFileOperationSkipSourcePermissionErrors);
|
||||
if (err != noErr) goto reportError;
|
||||
for (NSString *item in contents)
|
||||
{
|
||||
NSString *fromPath = [mountPoint stringByAppendingPathComponent:item];
|
||||
NSString *toPath = [[archivePath stringByDeletingLastPathComponent] stringByAppendingPathComponent:item];
|
||||
|
||||
// We skip any files in the DMG which are not readable.
|
||||
if (![manager isReadableFileAtPath:fromPath]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
SULog(@"copyItemAtPath:%@ toPath:%@", fromPath, toPath);
|
||||
|
||||
if (![manager copyItemAtPath:fromPath toPath:toPath error:&error])
|
||||
{
|
||||
SULog(@"Couldn't copy item: %@ : %@", error, error.userInfo ? error.userInfo : @"");
|
||||
goto reportError;
|
||||
}
|
||||
}
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self notifyDelegateOfSuccess];
|
||||
});
|
||||
goto finally;
|
||||
|
||||
reportError:
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self notifyDelegateOfFailure];
|
||||
});
|
||||
|
||||
finally:
|
||||
if (mountedSuccessfully)
|
||||
[NSTask launchedTaskWithLaunchPath:@"/usr/bin/hdiutil" arguments:@[@"detach", mountPoint, @"-force"]];
|
||||
else
|
||||
SULog(@"Can't mount DMG %@",archivePath);
|
||||
}
|
||||
|
||||
[self performSelectorOnMainThread:@selector(notifyDelegateOfSuccess) withObject:nil waitUntilDone:NO];
|
||||
goto finally;
|
||||
|
||||
reportError:
|
||||
[self performSelectorOnMainThread:@selector(notifyDelegateOfFailure) withObject:nil waitUntilDone:NO];
|
||||
|
||||
finally:
|
||||
if (mountedSuccessfully)
|
||||
[NSTask launchedTaskWithLaunchPath:@"/usr/bin/hdiutil" arguments:[NSArray arrayWithObjects:@"detach", mountPoint, @"-force", nil]];
|
||||
else
|
||||
SULog(@"Can't mount DMG %@",archivePath);
|
||||
[pool drain];
|
||||
}
|
||||
|
||||
- (void)start
|
||||
{
|
||||
[NSThread detachNewThreadSelector:@selector(extractDMG) toTarget:self withObject:nil];
|
||||
dispatch_async(dispatch_get_global_queue(0, 0), ^{
|
||||
[self extractDMG];
|
||||
});
|
||||
}
|
||||
|
||||
+ (void)load
|
||||
@@ -180,8 +149,9 @@ finally:
|
||||
BOOL result = NO;
|
||||
if(resultData)
|
||||
{
|
||||
NSString *data = [NSString stringWithCString:(char*)[resultData bytes] encoding:NSUTF8StringEncoding];
|
||||
if (!NSEqualRanges([data rangeOfString:@"passphrase-count"], NSMakeRange(NSNotFound, 0)))
|
||||
NSString *data = [[[NSString alloc] initWithData:resultData encoding:NSUTF8StringEncoding] autorelease];
|
||||
|
||||
if ((data != nil) && !NSEqualRanges([data rangeOfString:@"passphrase-count"], NSMakeRange(NSNotFound, 0)))
|
||||
{
|
||||
result = YES;
|
||||
}
|
||||
@@ -189,18 +159,4 @@ finally:
|
||||
return result;
|
||||
}
|
||||
|
||||
- (void)requestPasswordFromDelegate
|
||||
{
|
||||
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[self methodSignatureForSelector:@selector(continueWithPassword:)]];
|
||||
[invocation setSelector:@selector(continueWithPassword:)];
|
||||
[invocation setTarget:self];
|
||||
[invocation retainArguments];
|
||||
[delegate unarchiver:self requiresPasswordReturnedViaInvocation:invocation];
|
||||
}
|
||||
|
||||
- (void)continueWithPassword:(NSString *)password
|
||||
{
|
||||
[NSThread detachNewThreadSelector:@selector(extractDMGWithPassword:) toTarget:self withObject:password];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -13,26 +13,25 @@
|
||||
@interface SUHost : NSObject
|
||||
{
|
||||
@private
|
||||
NSBundle *bundle;
|
||||
NSString *defaultsDomain;
|
||||
BOOL usesStandardUserDefaults;
|
||||
}
|
||||
@property (retain, readonly) NSBundle *bundle;
|
||||
|
||||
+ (NSString *)systemVersionString;
|
||||
|
||||
- (id)initWithBundle:(NSBundle *)aBundle;
|
||||
- (NSBundle *)bundle;
|
||||
- (NSString *)bundlePath;
|
||||
- (NSString *)appSupportPath;
|
||||
- (NSString *)installationPath;
|
||||
- (NSString *)name;
|
||||
- (NSString *)version;
|
||||
- (NSString *)displayVersion;
|
||||
- (NSImage *)icon;
|
||||
- (BOOL)isRunningOnReadOnlyVolume;
|
||||
- (BOOL)isBackgroundApplication;
|
||||
- (NSString *)publicDSAKey;
|
||||
- (NSArray *)systemProfile;
|
||||
- (instancetype)initWithBundle:(NSBundle *)aBundle;
|
||||
@property (readonly, copy) NSString *bundlePath;
|
||||
@property (readonly, copy) NSString *appSupportPath;
|
||||
@property (readonly, copy) NSString *installationPath;
|
||||
@property (readonly, copy) NSString *name;
|
||||
@property (readonly, copy) NSString *version;
|
||||
@property (readonly, copy) NSString *displayVersion;
|
||||
@property (readonly, copy) NSImage *icon;
|
||||
@property (getter=isRunningOnReadOnlyVolume, readonly) BOOL runningOnReadOnlyVolume;
|
||||
@property (getter=isBackgroundApplication, readonly) BOOL backgroundApplication;
|
||||
@property (readonly, copy) NSString *publicDSAKey;
|
||||
@property (readonly, copy) NSArray *systemProfile;
|
||||
|
||||
- (id)objectForInfoDictionaryKey:(NSString *)key;
|
||||
- (BOOL)boolForInfoDictionaryKey:(NSString *)key;
|
||||
|
||||
@@ -9,24 +9,30 @@
|
||||
|
||||
#import "SUConstants.h"
|
||||
#import "SUSystemProfiler.h"
|
||||
#import <sys/mount.h> // For statfs for isRunningOnReadOnlyVolume
|
||||
#include <sys/mount.h> // For statfs for isRunningOnReadOnlyVolume
|
||||
#import "SULog.h"
|
||||
|
||||
@interface SUHost ()
|
||||
@property (retain, readwrite) NSBundle *bundle;
|
||||
@end
|
||||
|
||||
@implementation SUHost
|
||||
@synthesize bundle;
|
||||
|
||||
- (id)initWithBundle:(NSBundle *)aBundle
|
||||
- (instancetype)initWithBundle:(NSBundle *)aBundle
|
||||
{
|
||||
if ((self = [super init]))
|
||||
{
|
||||
if (aBundle == nil) aBundle = [NSBundle mainBundle];
|
||||
bundle = [aBundle retain];
|
||||
if (![bundle bundleIdentifier])
|
||||
self.bundle = aBundle;
|
||||
if (![bundle bundleIdentifier]) {
|
||||
SULog(@"Sparkle Error: the bundle being updated at %@ has no CFBundleIdentifier! This will cause preference read/write to not work properly.", bundle);
|
||||
}
|
||||
|
||||
defaultsDomain = [[bundle objectForInfoDictionaryKey:SUDefaultsDomainKey] retain];
|
||||
if (!defaultsDomain)
|
||||
if (!defaultsDomain) {
|
||||
defaultsDomain = [[bundle bundleIdentifier] retain];
|
||||
}
|
||||
|
||||
// If we're using the main bundle's defaults we'll use the standard user defaults mechanism, otherwise we have to get CF-y.
|
||||
usesStandardUserDefaults = [defaultsDomain isEqualToString:[[NSBundle mainBundle] bundleIdentifier]];
|
||||
@@ -37,17 +43,12 @@
|
||||
- (void)dealloc
|
||||
{
|
||||
[defaultsDomain release];
|
||||
[bundle release];
|
||||
self.bundle = nil;
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (NSString *)description { return [NSString stringWithFormat:@"%@ <%@, %@>", [self class], [self bundlePath], [self installationPath]]; }
|
||||
|
||||
- (NSBundle *)bundle
|
||||
{
|
||||
return bundle;
|
||||
}
|
||||
|
||||
- (NSString *)bundlePath
|
||||
{
|
||||
return [bundle bundlePath];
|
||||
@@ -62,9 +63,11 @@
|
||||
SULog(@"Failed to find app support directory! Using ~/Library/Application Support...");
|
||||
appSupportPath = [@"~/Library/Application Support" stringByExpandingTildeInPath];
|
||||
}
|
||||
else
|
||||
appSupportPath = [appSupportPaths objectAtIndex:0];
|
||||
else {
|
||||
appSupportPath = appSupportPaths[0];
|
||||
}
|
||||
appSupportPath = [appSupportPath stringByAppendingPathComponent:[self name]];
|
||||
appSupportPath = [appSupportPath stringByAppendingPathComponent:@".Sparkle"];
|
||||
return appSupportPath;
|
||||
}
|
||||
|
||||
@@ -73,8 +76,9 @@
|
||||
#if NORMALIZE_INSTALLED_APP_NAME
|
||||
// We'll install to "#{CFBundleName}.app", but only if that path doesn't already exist. If we're "Foo 4.2.app," and there's a "Foo.app" in this directory, we don't want to overwrite it! But if there's no "Foo.app," we'll take that name.
|
||||
NSString *normalizedAppPath = [[[bundle bundlePath] stringByDeletingLastPathComponent] stringByAppendingPathComponent: [NSString stringWithFormat: @"%@.%@", [bundle objectForInfoDictionaryKey:@"CFBundleName"], [[bundle bundlePath] pathExtension]]];
|
||||
if (![[NSFileManager defaultManager] fileExistsAtPath:[[[bundle bundlePath] stringByDeletingLastPathComponent] stringByAppendingPathComponent: [NSString stringWithFormat: @"%@.%@", [bundle objectForInfoDictionaryKey:@"CFBundleName"], [[bundle bundlePath] pathExtension]]]])
|
||||
if (![[NSFileManager defaultManager] fileExistsAtPath:[[[bundle bundlePath] stringByDeletingLastPathComponent] stringByAppendingPathComponent: [NSString stringWithFormat: @"%@.%@", [bundle objectForInfoDictionaryKey:@"CFBundleName"], [[bundle bundlePath] pathExtension]]]]) {
|
||||
return normalizedAppPath;
|
||||
}
|
||||
#endif
|
||||
return [bundle bundlePath];
|
||||
}
|
||||
@@ -116,26 +120,22 @@
|
||||
// extension, although it may."
|
||||
//
|
||||
// However, if it *does* include the '.icns' the above method fails (tested on OS X 10.3.9) so we'll also try:
|
||||
if (!iconPath)
|
||||
if (!iconPath) {
|
||||
iconPath = [bundle pathForResource:[bundle objectForInfoDictionaryKey:@"CFBundleIconFile"] ofType: nil];
|
||||
}
|
||||
NSImage *icon = [[[NSImage alloc] initWithContentsOfFile:iconPath] autorelease];
|
||||
// Use a default icon if none is defined.
|
||||
if (!icon) {
|
||||
BOOL isMainBundle = (bundle == [NSBundle mainBundle]);
|
||||
|
||||
// Starting with 10.6, iconForFileType: accepts a UTI.
|
||||
NSString *fileType = nil;
|
||||
if (floor(NSAppKitVersionNumber) <= NSAppKitVersionNumber10_5)
|
||||
fileType = isMainBundle ? NSFileTypeForHFSTypeCode(kGenericApplicationIcon) : @".bundle";
|
||||
else
|
||||
fileType = isMainBundle ? (NSString*)kUTTypeApplication : (NSString*)kUTTypeBundle;
|
||||
|
||||
NSString *fileType = isMainBundle ? (NSString*)kUTTypeApplication : (NSString*)kUTTypeBundle;
|
||||
icon = [[NSWorkspace sharedWorkspace] iconForFileType:fileType];
|
||||
}
|
||||
return icon;
|
||||
}
|
||||
|
||||
- (BOOL)isRunningOnReadOnlyVolume
|
||||
{
|
||||
{
|
||||
struct statfs statfs_info;
|
||||
statfs([[bundle bundlePath] fileSystemRepresentation], &statfs_info);
|
||||
return (statfs_info.f_flags & MNT_RDONLY);
|
||||
@@ -143,13 +143,7 @@
|
||||
|
||||
- (BOOL)isBackgroundApplication
|
||||
{
|
||||
ProcessSerialNumber PSN;
|
||||
GetCurrentProcess(&PSN);
|
||||
CFDictionaryRef processInfo = ProcessInformationCopyDictionary(&PSN, kProcessDictionaryIncludeAllInformationMask);
|
||||
BOOL isElement = [[(NSDictionary *)processInfo objectForKey:@"LSUIElement"] boolValue];
|
||||
if (processInfo)
|
||||
CFRelease(processInfo);
|
||||
return isElement;
|
||||
return ([[NSApplication sharedApplication] activationPolicy] == NSApplicationActivationPolicyAccessory);
|
||||
}
|
||||
|
||||
- (NSString *)publicDSAKey
|
||||
@@ -185,11 +179,12 @@
|
||||
// Under Tiger, CFPreferencesCopyAppValue doesn't get values from NSRegistrationDomain, so anything
|
||||
// passed into -[NSUserDefaults registerDefaults:] is ignored. The following line falls
|
||||
// back to using NSUserDefaults, but only if the host bundle is the main bundle.
|
||||
if (usesStandardUserDefaults)
|
||||
if (usesStandardUserDefaults) {
|
||||
return [[NSUserDefaults standardUserDefaults] objectForKey:defaultName];
|
||||
}
|
||||
|
||||
CFPropertyListRef obj = CFPreferencesCopyAppValue((CFStringRef)defaultName, (CFStringRef)defaultsDomain);
|
||||
return [(id)CFMakeCollectable(obj) autorelease];
|
||||
return CFBridgingRelease(obj);
|
||||
}
|
||||
|
||||
- (void)setObject:(id)value forUserDefaultsKey:(NSString *)defaultName;
|
||||
@@ -207,13 +202,15 @@
|
||||
|
||||
- (BOOL)boolForUserDefaultsKey:(NSString *)defaultName
|
||||
{
|
||||
if (usesStandardUserDefaults)
|
||||
if (usesStandardUserDefaults) {
|
||||
return [[NSUserDefaults standardUserDefaults] boolForKey:defaultName];
|
||||
}
|
||||
|
||||
BOOL value;
|
||||
CFPropertyListRef plr = CFPreferencesCopyAppValue((CFStringRef)defaultName, (CFStringRef)defaultsDomain);
|
||||
if (plr == NULL)
|
||||
if (plr == NULL) {
|
||||
value = NO;
|
||||
}
|
||||
else
|
||||
{
|
||||
value = (BOOL)CFBooleanGetValue((CFBooleanRef)plr);
|
||||
@@ -230,7 +227,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
CFPreferencesSetValue((CFStringRef)defaultName, (CFBooleanRef)[NSNumber numberWithBool:value], (CFStringRef)defaultsDomain, kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
|
||||
CFPreferencesSetValue((CFStringRef)defaultName, (CFBooleanRef)@(value), (CFStringRef)defaultsDomain, kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
|
||||
CFPreferencesSynchronize((CFStringRef)defaultsDomain, kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
|
||||
}
|
||||
}
|
||||
@@ -245,26 +242,8 @@
|
||||
|
||||
+ (NSString *)systemVersionString
|
||||
{
|
||||
// This returns a version string of the form X.Y.Z
|
||||
// There may be a better way to deal with the problem that gestaltSystemVersionMajor
|
||||
// et al. are not defined in 10.3, but this is probably good enough.
|
||||
NSString* verStr = nil;
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_4
|
||||
SInt32 major, minor, bugfix;
|
||||
OSErr err1 = Gestalt(gestaltSystemVersionMajor, &major);
|
||||
OSErr err2 = Gestalt(gestaltSystemVersionMinor, &minor);
|
||||
OSErr err3 = Gestalt(gestaltSystemVersionBugFix, &bugfix);
|
||||
if (!err1 && !err2 && !err3)
|
||||
{
|
||||
verStr = [NSString stringWithFormat:@"%ld.%ld.%ld", (long)major, (long)minor, (long)bugfix];
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
NSString *versionPlistPath = @"/System/Library/CoreServices/SystemVersion.plist";
|
||||
verStr = [[NSDictionary dictionaryWithContentsOfFile:versionPlistPath] objectForKey:@"ProductVersion"];
|
||||
}
|
||||
return verStr;
|
||||
NSString *versionPlistPath = @"/System/Library/CoreServices/SystemVersion.plist";
|
||||
return [NSDictionary dictionaryWithContentsOfFile:versionPlistPath][@"ProductVersion"];
|
||||
}
|
||||
|
||||
@end
|
||||
+1
-2
@@ -13,12 +13,11 @@
|
||||
#import "SUVersionComparisonProtocol.h"
|
||||
|
||||
@class SUHost;
|
||||
@interface SUInstaller : NSObject { }
|
||||
@interface SUInstaller : NSObject
|
||||
+ (NSString *) appPathInUpdateFolder:(NSString *)updateFolder forHost:(SUHost *)host;
|
||||
+ (void) installFromUpdateFolder:(NSString *)updateFolder overHost:(SUHost *)host installationPath:(NSString *)installationPath delegate:delegate synchronously:(BOOL)synchronously versionComparator:(id <SUVersionComparison>)comparator;
|
||||
+ (void) finishInstallationToPath:(NSString *)installationPath withResult:(BOOL)result host:(SUHost *)host error:(NSError *)error delegate:delegate;
|
||||
+ (NSString*) updateFolder;
|
||||
+ (void) notifyDelegateOfFailure: (NSDictionary*)dict;
|
||||
@end
|
||||
|
||||
@interface NSObject (SUInstallerDelegateInformalProtocol)
|
||||
|
||||
+13
-13
@@ -124,7 +124,7 @@ static NSString* sUpdateFolder = nil;
|
||||
|
||||
if (newAppDownloadPath == nil)
|
||||
{
|
||||
[self finishInstallationToPath:installationPath withResult:NO host:host error:[NSError errorWithDomain:SUSparkleErrorDomain code:SUMissingUpdateError userInfo:[NSDictionary dictionaryWithObject:@"Couldn't find an appropriate update in the downloaded package." forKey:NSLocalizedDescriptionKey]] delegate:delegate];
|
||||
[self finishInstallationToPath:installationPath withResult:NO host:host error:[NSError errorWithDomain:SUSparkleErrorDomain code:SUMissingUpdateError userInfo:@{NSLocalizedDescriptionKey: @"Couldn't find an appropriate update in the downloaded package."}] delegate:delegate];
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -140,7 +140,7 @@ static NSString* sUpdateFolder = nil;
|
||||
|
||||
NSTask *mdimport = [[[NSTask alloc] init] autorelease];
|
||||
[mdimport setLaunchPath:@"/usr/bin/mdimport"];
|
||||
[mdimport setArguments:[NSArray arrayWithObject:installationPath]];
|
||||
[mdimport setArguments:@[installationPath]];
|
||||
@try
|
||||
{
|
||||
[mdimport launch];
|
||||
@@ -163,20 +163,20 @@ static NSString* sUpdateFolder = nil;
|
||||
if (result)
|
||||
{
|
||||
[self mdimportInstallationPath:installationPath];
|
||||
if ([delegate respondsToSelector:@selector(installerFinishedForHost:)])
|
||||
[delegate performSelectorOnMainThread: @selector(installerFinishedForHost:) withObject: host waitUntilDone: NO];
|
||||
if ([delegate respondsToSelector:@selector(installerFinishedForHost:)]) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[delegate installerFinishedForHost:host];
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ([delegate respondsToSelector:@selector(installerForHost:failedWithError:)])
|
||||
[self performSelectorOnMainThread: @selector(notifyDelegateOfFailure:) withObject: [NSDictionary dictionaryWithObjectsAndKeys: host, SUNotifyDictHostKey, error, SUNotifyDictErrorKey, delegate, SUNotifyDictDelegateKey, nil] waitUntilDone: NO];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+(void) notifyDelegateOfFailure: (NSDictionary*)dict
|
||||
{
|
||||
[[dict objectForKey: SUNotifyDictDelegateKey] installerForHost: [dict objectForKey: SUNotifyDictHostKey] failedWithError: [dict objectForKey: SUNotifyDictErrorKey]];
|
||||
if ([delegate respondsToSelector:@selector(installerForHost:failedWithError:)]) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[delegate installerForHost:host failedWithError:error];
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -9,7 +9,7 @@
|
||||
<key>iMac4,1</key>
|
||||
<string>iMac (Core Duo)</string>
|
||||
<key>iMac4,2</key>
|
||||
<string>iMac for Education (17-inch, Core Duo)</string>
|
||||
<string>iMac for Education (17 inch, Core Duo)</string>
|
||||
<key>iMac5,1</key>
|
||||
<string>iMac (Core 2 Duo, 17 or 20 inch, SuperDrive)</string>
|
||||
<key>iMac5,2</key>
|
||||
@@ -17,19 +17,65 @@
|
||||
<key>iMac6,1</key>
|
||||
<string>iMac (Core 2 Duo, 24 inch, SuperDrive)</string>
|
||||
<key>iMac8,1</key>
|
||||
<string>iMac (April 2008)</string>
|
||||
<string>iMac (Core 2 Duo, 20 or 24 inch, Early 2008 )</string>
|
||||
<key>iMac9,1</key>
|
||||
<string>iMac (Core 2 Duo, 20 or 24 inch, Early or Mid 2009 )</string>
|
||||
<key>iMac10,1</key>
|
||||
<string>iMac (Core 2 Duo, 21.5 or 27 inch, Late 2009 )</string>
|
||||
<key>iMac11,1</key>
|
||||
<string>iMac (Core i5 or i7, 27 inch Late 2009)</string>
|
||||
<key>iMac11,2</key>
|
||||
<string>iMac (Core i3 or i5, 27 inch Mid 2010)</string>
|
||||
<key>iMac11,3</key>
|
||||
<string>iMac (Core i5 or i7, 27 inch Mid 2010)</string>
|
||||
<key>iMac12,1</key>
|
||||
<string>iMac (Core i3 or i5 or i7, 21.5 inch Mid 2010 or Late 2011)</string>
|
||||
<key>iMac12,2</key>
|
||||
<string>iMac (Core i5 or i7, 27 inch Mid 2011)</string>
|
||||
<key>iMac13,1</key>
|
||||
<string>iMac (Core i3 or i5 or i7, 21.5 inch Late 2012 or Early 2013)</string>
|
||||
<key>iMac13,2</key>
|
||||
<string>iMac (Core i5 or i7, 27 inch Late 2012)</string>
|
||||
<key>iMac14,1</key>
|
||||
<string>iMac (Core i5, 21.5 inch Late 2013)</string>
|
||||
<key>iMac14,2</key>
|
||||
<string>iMac (Core i5 or i7, 27 inch Late 2013)</string>
|
||||
<key>iMac14,3</key>
|
||||
<string>iMac (Core i5 or i7, 21.5 inch Late 2013)</string>
|
||||
<key>MacBook1,1</key>
|
||||
<string>MacBook (Core Duo)</string>
|
||||
<key>MacBook2,1</key>
|
||||
<string>MacBook (Core 2 Duo)</string>
|
||||
<key>MacBook4,1</key>
|
||||
<string>MacBook (Core 2 Duo Feb 2008)</string>
|
||||
<key>MacBook5,1</key>
|
||||
<string>MacBook (Core 2 Duo, Late 2008, Unibody)</string>
|
||||
<key>MacBook5,2</key>
|
||||
<string>MacBook (Core 2 Duo, Early 2009, White)</string>
|
||||
<key>MacBook6,1</key>
|
||||
<string>MacBook (Core 2 Duo, Late 2009, Unibody)</string>
|
||||
<key>MacBook7,1</key>
|
||||
<string>MacBook (Core 2 Duo, Mid 2010, White)</string>
|
||||
<key>MacBookAir1,1</key>
|
||||
<string>MacBook Air (January 2008)</string>
|
||||
<string>MacBook Air (Core 2 Duo, 13 inch, Early 2008)</string>
|
||||
<key>MacBookAir2,1</key>
|
||||
<string>MacBook Air (June 2009)</string>
|
||||
<string>MacBook Air (Core 2 Duo, 13 inch, Mid 2009)</string>
|
||||
<key>MacBookAir3,1</key>
|
||||
<string>MacBook Air (October 2010)</string>
|
||||
<string>MacBook Air (Core 2 Duo, 11 inch, Late 2010)</string>
|
||||
<key>MacBookAir3,2</key>
|
||||
<string>MacBook Air (Core 2 Duo, 13 inch, Late 2010)</string>
|
||||
<key>MacBookAir4,1</key>
|
||||
<string>MacBook Air (Core i5 or i7, 11 inch, Mid 2011)</string>
|
||||
<key>MacBookAir4,2</key>
|
||||
<string>MacBook Air (Core i5 or i7, 13 inch, Mid 2011)</string>
|
||||
<key>MacBookAir5,1</key>
|
||||
<string>MacBook Air (Core i5 or i7, 11 inch, Mid 2012)</string>
|
||||
<key>MacBookAir5,2</key>
|
||||
<string>MacBook Air (Core i5 or i7, 13 inch, Mid 2012)</string>
|
||||
<key>MacBookAir6,1</key>
|
||||
<string>MacBook Air (Core i5 or i7, 11 inch, Mid 2013 or Early 2014)</string>
|
||||
<key>MacBookAir6,2</key>
|
||||
<string>MacBook Air (Core i5 or i7, 13 inch, Mid 2013 or Early 2014)</string>
|
||||
<key>MacBookPro1,1</key>
|
||||
<string>MacBook Pro Core Duo (15-inch)</string>
|
||||
<key>MacBookPro1,2</key>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#import "SUVersionComparisonProtocol.h"
|
||||
#import "SUPlainInstaller.h"
|
||||
|
||||
@interface SUPackageInstaller : SUPlainInstaller { }
|
||||
@interface SUPackageInstaller : SUPlainInstaller
|
||||
@end
|
||||
|
||||
#endif
|
||||
+24
-27
@@ -20,20 +20,20 @@ NSString *SUPackageInstallerInstallationPathKey = @"SUPackageInstallerInstallati
|
||||
|
||||
+ (void)finishInstallationWithInfo:(NSDictionary *)info
|
||||
{
|
||||
[self finishInstallationToPath:[info objectForKey:SUPackageInstallerInstallationPathKey] withResult:YES host:[info objectForKey:SUPackageInstallerHostKey] error:nil delegate:[info objectForKey:SUPackageInstallerDelegateKey]];
|
||||
[self finishInstallationToPath:info[SUPackageInstallerInstallationPathKey] withResult:YES host:info[SUPackageInstallerHostKey] error:nil delegate:info[SUPackageInstallerDelegateKey]];
|
||||
}
|
||||
|
||||
+ (void)performInstallationWithInfo:(NSDictionary *)info
|
||||
{
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
NSTask *installer = [NSTask launchedTaskWithLaunchPath:[info objectForKey:SUPackageInstallerCommandKey] arguments:[info objectForKey:SUPackageInstallerArgumentsKey]];
|
||||
[installer waitUntilExit];
|
||||
|
||||
// Known bug: if the installation fails or is canceled, Sparkle goes ahead and restarts, thinking everything is fine.
|
||||
[self performSelectorOnMainThread:@selector(finishInstallationWithInfo:) withObject:info waitUntilDone:NO];
|
||||
|
||||
[pool drain];
|
||||
@autoreleasepool {
|
||||
NSTask *installer = [NSTask launchedTaskWithLaunchPath:info[SUPackageInstallerCommandKey] arguments:info[SUPackageInstallerArgumentsKey]];
|
||||
[installer waitUntilExit];
|
||||
|
||||
// Known bug: if the installation fails or is canceled, Sparkle goes ahead and restarts, thinking everything is fine.
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self finishInstallationWithInfo:info];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
+ (void)performInstallationToPath:(NSString *)installationPath fromPath:(NSString *)path host:(SUHost *)host delegate:delegate synchronously:(BOOL)synchronously versionComparator:(id <SUVersionComparison>)comparator
|
||||
@@ -41,31 +41,28 @@ NSString *SUPackageInstallerInstallationPathKey = @"SUPackageInstallerInstallati
|
||||
NSString *command;
|
||||
NSArray *args;
|
||||
|
||||
if (floor(NSAppKitVersionNumber) == NSAppKitVersionNumber10_4) {
|
||||
// 10.4 uses Installer.app because the "open" command in 10.4 doesn't support -W and -n
|
||||
command = [[NSBundle bundleWithIdentifier:@"com.apple.installer"] executablePath];
|
||||
args = [NSArray arrayWithObjects:path, nil];
|
||||
} else {
|
||||
// 10.5 and later. Run installer using the "open" command to ensure it is launched in front of current application.
|
||||
// The -W and -n options were added to the 'open' command in 10.5
|
||||
// -W = wait until the app has quit.
|
||||
// -n = Open another instance if already open.
|
||||
// -b = app bundle identifier
|
||||
command = @"/usr/bin/open";
|
||||
args = [NSArray arrayWithObjects:@"-W", @"-n", @"-b", @"com.apple.installer", path, nil];
|
||||
}
|
||||
// Run installer using the "open" command to ensure it is launched in front of current application.
|
||||
// -W = wait until the app has quit.
|
||||
// -n = Open another instance if already open.
|
||||
// -b = app bundle identifier
|
||||
command = @"/usr/bin/open";
|
||||
args = @[@"-W", @"-n", @"-b", @"com.apple.installer", path];
|
||||
|
||||
if (![[NSFileManager defaultManager] fileExistsAtPath:command])
|
||||
{
|
||||
NSError *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUMissingInstallerToolError userInfo:[NSDictionary dictionaryWithObject:@"Couldn't find Apple's installer tool!" forKey:NSLocalizedDescriptionKey]];
|
||||
NSError *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUMissingInstallerToolError userInfo:@{NSLocalizedDescriptionKey: @"Couldn't find Apple's installer tool!"}];
|
||||
[self finishInstallationToPath:installationPath withResult:NO host:host error:error delegate:delegate];
|
||||
}
|
||||
else
|
||||
{
|
||||
NSDictionary *info = [NSDictionary dictionaryWithObjectsAndKeys:command, SUPackageInstallerCommandKey, args, SUPackageInstallerArgumentsKey, host, SUPackageInstallerHostKey, delegate, SUPackageInstallerDelegateKey, installationPath, SUPackageInstallerInstallationPathKey, nil];
|
||||
NSDictionary *info = @{SUPackageInstallerCommandKey: command, SUPackageInstallerArgumentsKey: args, SUPackageInstallerHostKey: host, SUPackageInstallerDelegateKey: delegate, SUPackageInstallerInstallationPathKey: installationPath};
|
||||
if (synchronously)
|
||||
[self performInstallationWithInfo:info];
|
||||
else
|
||||
[NSThread detachNewThreadSelector:@selector(performInstallationWithInfo:) toTarget:self withObject:info];
|
||||
else {
|
||||
dispatch_async(dispatch_get_global_queue(0, 0), ^{
|
||||
[self performInstallationWithInfo:info];
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
//
|
||||
// SUPasswordPrompt.h
|
||||
// Sparkle
|
||||
//
|
||||
// Created by rudy on 8/18/09.
|
||||
// Copyright 2009 Ambrosia Software, Inc.. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "Sparkle/SUWindowController.h"
|
||||
|
||||
@interface SUPasswordPrompt : SUWindowController
|
||||
{
|
||||
IBOutlet NSImageView *mIconView;
|
||||
IBOutlet NSTextField *mTextDescription;
|
||||
IBOutlet NSSecureTextField *mPasswordField;
|
||||
NSString *mPassword;
|
||||
NSString *mName;
|
||||
NSImage *mIcon;
|
||||
}
|
||||
|
||||
- (id)initWithHost:(SUHost *)aHost;
|
||||
- (NSInteger)run;
|
||||
- (NSString *)password;
|
||||
|
||||
@end
|
||||
@@ -1,86 +0,0 @@
|
||||
//
|
||||
// SUPasswordPrompt.m
|
||||
// Sparkle
|
||||
//
|
||||
// Created by rudy on 8/18/09.
|
||||
// Copyright 2009 Ambrosia Software, Inc.. All rights reserved.
|
||||
//
|
||||
|
||||
#import "SUPasswordPrompt.h"
|
||||
|
||||
|
||||
@implementation SUPasswordPrompt
|
||||
|
||||
- (id)initWithHost:(SUHost *)aHost
|
||||
{
|
||||
self = [super initWithHost:aHost windowNibName:@"SUPasswordPrompt"];
|
||||
if (self)
|
||||
{
|
||||
[self setName:[aHost name]];
|
||||
[self setIcon:[aHost icon]];
|
||||
mPassword = nil;
|
||||
[self setShouldCascadeWindows:NO];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)awakeFromNib
|
||||
{
|
||||
[mIconView setImage:[self icon]];
|
||||
}
|
||||
|
||||
- (void)setName:(NSString*)name
|
||||
{
|
||||
[mName release];
|
||||
mName = [name retain];
|
||||
}
|
||||
|
||||
- (NSString*)name
|
||||
{
|
||||
return mName;
|
||||
}
|
||||
|
||||
- (void)setIcon:(NSImage*)icon
|
||||
{
|
||||
[mIcon release];
|
||||
mIcon = [icon retain];
|
||||
}
|
||||
|
||||
- (NSImage*)icon
|
||||
{
|
||||
return mIcon;
|
||||
}
|
||||
|
||||
- (NSString *)password
|
||||
{
|
||||
return mPassword;
|
||||
}
|
||||
|
||||
- (void)setPassword:(NSString*)password
|
||||
{
|
||||
[mPassword release];
|
||||
mPassword = [password retain];
|
||||
}
|
||||
|
||||
- (NSInteger)run
|
||||
{
|
||||
//modally run a password prompt
|
||||
NSInteger result = [NSApp runModalForWindow:[self window]];
|
||||
if(result)
|
||||
[self setPassword:[mPasswordField stringValue]];
|
||||
return result;
|
||||
}
|
||||
|
||||
- (IBAction)accept:(id)sender
|
||||
{
|
||||
[[self window] orderOut:self];
|
||||
[NSApp stopModalWithCode:1];
|
||||
}
|
||||
|
||||
- (IBAction)cancel:(id)sender
|
||||
{
|
||||
[[self window] orderOut:self];
|
||||
[NSApp stopModalWithCode:0];
|
||||
}
|
||||
|
||||
@end
|
||||
+1
-3
@@ -12,9 +12,7 @@
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "SUUnarchiver.h"
|
||||
|
||||
@interface SUPipedUnarchiver : SUUnarchiver {
|
||||
|
||||
}
|
||||
@interface SUPipedUnarchiver : SUUnarchiver
|
||||
|
||||
@end
|
||||
|
||||
|
||||
+61
-62
@@ -17,18 +17,16 @@
|
||||
{
|
||||
static NSDictionary *typeSelectorDictionary;
|
||||
if (!typeSelectorDictionary)
|
||||
typeSelectorDictionary = [[NSDictionary dictionaryWithObjectsAndKeys:@"extractZIP", @".zip", @"extractTAR", @".tar",
|
||||
@"extractTGZ", @".tar.gz", @"extractTGZ", @".tgz",
|
||||
@"extractTBZ", @".tar.bz2", @"extractTBZ", @".tbz", nil] retain];
|
||||
typeSelectorDictionary = [@{@".zip": @"extractZIP", @".tar": @"extractTAR",
|
||||
@".tar.gz": @"extractTGZ", @".tgz": @"extractTGZ",
|
||||
@".tar.bz2": @"extractTBZ", @".tbz": @"extractTBZ"} retain];
|
||||
|
||||
NSString *lastPathComponent = [path lastPathComponent];
|
||||
NSEnumerator *typeEnumerator = [typeSelectorDictionary keyEnumerator];
|
||||
id currentType;
|
||||
while ((currentType = [typeEnumerator nextObject]))
|
||||
for (id currentType in typeSelectorDictionary)
|
||||
{
|
||||
if ([currentType length] > [lastPathComponent length]) continue;
|
||||
if ([[lastPathComponent substringFromIndex:[lastPathComponent length] - [currentType length]] isEqualToString:currentType])
|
||||
return NSSelectorFromString([typeSelectorDictionary objectForKey:currentType]);
|
||||
return NSSelectorFromString(typeSelectorDictionary[currentType]);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@@ -47,65 +45,66 @@
|
||||
- (void)extractArchivePipingDataToCommand:(NSString *)command
|
||||
{
|
||||
// *** GETS CALLED ON NON-MAIN THREAD!!!
|
||||
|
||||
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
FILE *fp = NULL, *cmdFP = NULL;
|
||||
char *oldDestinationString = NULL;
|
||||
|
||||
SULog(@"Extracting %@ using '%@'",archivePath,command);
|
||||
|
||||
// Get the file size.
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4
|
||||
NSNumber *fs = [[[NSFileManager defaultManager] fileAttributesAtPath:archivePath traverseLink:NO] objectForKey:NSFileSize];
|
||||
#else
|
||||
NSNumber *fs = [[[NSFileManager defaultManager] attributesOfItemAtPath:archivePath error:nil] objectForKey:NSFileSize];
|
||||
#endif
|
||||
if (fs == nil) goto reportError;
|
||||
|
||||
// Thank you, Allan Odgaard!
|
||||
// (who wrote the following extraction alg.)
|
||||
fp = fopen([archivePath fileSystemRepresentation], "r");
|
||||
if (!fp) goto reportError;
|
||||
|
||||
oldDestinationString = getenv("DESTINATION");
|
||||
setenv("DESTINATION", [[archivePath stringByDeletingLastPathComponent] fileSystemRepresentation], 1);
|
||||
cmdFP = popen([command fileSystemRepresentation], "w");
|
||||
size_t written;
|
||||
if (!cmdFP) goto reportError;
|
||||
|
||||
char buf[32*1024];
|
||||
size_t len;
|
||||
while((len = fread(buf, 1, 32*1024, fp)))
|
||||
{
|
||||
written = fwrite(buf, 1, len, cmdFP);
|
||||
if( written < len )
|
||||
@autoreleasepool {
|
||||
FILE *fp = NULL, *cmdFP = NULL;
|
||||
char *oldDestinationString = NULL;
|
||||
|
||||
SULog(@"Extracting %@ using '%@'",archivePath,command);
|
||||
|
||||
// Get the file size.
|
||||
NSNumber *fs = [[NSFileManager defaultManager] attributesOfItemAtPath:archivePath error:nil][NSFileSize];
|
||||
if (fs == nil) goto reportError;
|
||||
|
||||
// Thank you, Allan Odgaard!
|
||||
// (who wrote the following extraction alg.)
|
||||
fp = fopen([archivePath fileSystemRepresentation], "r");
|
||||
if (!fp) goto reportError;
|
||||
|
||||
oldDestinationString = getenv("DESTINATION");
|
||||
setenv("DESTINATION", [[archivePath stringByDeletingLastPathComponent] fileSystemRepresentation], 1);
|
||||
cmdFP = popen([command fileSystemRepresentation], "w");
|
||||
size_t written;
|
||||
if (!cmdFP) goto reportError;
|
||||
|
||||
char buf[32*1024];
|
||||
size_t len;
|
||||
while((len = fread(buf, 1, 32*1024, fp)))
|
||||
{
|
||||
pclose(cmdFP);
|
||||
written = fwrite(buf, 1, len, cmdFP);
|
||||
if( written < len )
|
||||
{
|
||||
pclose(cmdFP);
|
||||
goto reportError;
|
||||
}
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self notifyDelegateOfExtractedLength:len];
|
||||
});
|
||||
}
|
||||
pclose(cmdFP);
|
||||
|
||||
if (ferror(fp)) {
|
||||
goto reportError;
|
||||
}
|
||||
|
||||
[self performSelectorOnMainThread:@selector(notifyDelegateOfExtractedLength:) withObject:[NSNumber numberWithUnsignedLong:len] waitUntilDone:NO];
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self notifyDelegateOfSuccess];
|
||||
});
|
||||
goto finally;
|
||||
|
||||
reportError:
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self notifyDelegateOfFailure];
|
||||
});
|
||||
|
||||
finally:
|
||||
if (fp)
|
||||
fclose(fp);
|
||||
if (oldDestinationString)
|
||||
setenv("DESTINATION", oldDestinationString, 1);
|
||||
else
|
||||
unsetenv("DESTINATION");
|
||||
}
|
||||
pclose(cmdFP);
|
||||
|
||||
if( ferror( fp ) )
|
||||
goto reportError;
|
||||
|
||||
[self performSelectorOnMainThread:@selector(notifyDelegateOfSuccess) withObject:nil waitUntilDone:NO];
|
||||
goto finally;
|
||||
|
||||
reportError:
|
||||
[self performSelectorOnMainThread:@selector(notifyDelegateOfFailure) withObject:nil waitUntilDone:NO];
|
||||
|
||||
finally:
|
||||
if (fp)
|
||||
fclose(fp);
|
||||
if (oldDestinationString)
|
||||
setenv("DESTINATION", oldDestinationString, 1);
|
||||
else
|
||||
unsetenv("DESTINATION");
|
||||
[pool release];
|
||||
}
|
||||
|
||||
- (void)extractTAR
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@
|
||||
|
||||
@class SUHost;
|
||||
|
||||
@interface SUPlainInstaller : SUInstaller { }
|
||||
@interface SUPlainInstaller : SUInstaller
|
||||
+ (void)performInstallationToPath:(NSString *)installationPath fromPath:(NSString *)path host:(SUHost *)host delegate:delegate synchronously:(BOOL)synchronously versionComparator:(id <SUVersionComparison>)comparator;
|
||||
@end
|
||||
|
||||
|
||||
+30
-27
@@ -26,36 +26,36 @@ static NSString * const SUInstallerInstallationPathKey = @"SUInstallerInstallati
|
||||
{
|
||||
// *** GETS CALLED ON NON-MAIN THREAD!
|
||||
|
||||
[self finishInstallationToPath:[info objectForKey:SUInstallerInstallationPathKey] withResult:[[info objectForKey:SUInstallerResultKey] boolValue] host:[info objectForKey:SUInstallerHostKey] error:[info objectForKey:SUInstallerErrorKey] delegate:[info objectForKey:SUInstallerDelegateKey]];
|
||||
[self finishInstallationToPath:info[SUInstallerInstallationPathKey] withResult:[info[SUInstallerResultKey] boolValue] host:info[SUInstallerHostKey] error:info[SUInstallerErrorKey] delegate:info[SUInstallerDelegateKey]];
|
||||
}
|
||||
|
||||
+ (void)performInstallationWithInfo:(NSDictionary *)info
|
||||
{
|
||||
// *** GETS CALLED ON NON-MAIN THREAD!
|
||||
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
NSError *error = nil;
|
||||
|
||||
NSString * oldPath = [[info objectForKey:SUInstallerHostKey] bundlePath];
|
||||
NSString * installationPath = [info objectForKey:SUInstallerInstallationPathKey];
|
||||
BOOL result = [self copyPathWithAuthentication:[info objectForKey:SUInstallerPathKey] overPath: installationPath temporaryName:[info objectForKey:SUInstallerTempNameKey] error:&error];
|
||||
|
||||
if( result )
|
||||
{
|
||||
BOOL haveOld = [[NSFileManager defaultManager] fileExistsAtPath: oldPath];
|
||||
BOOL differentFromNew = ![oldPath isEqualToString: installationPath];
|
||||
if( haveOld && differentFromNew )
|
||||
[self _movePathToTrash: oldPath]; // On success, trash old copy if there's still one due to renaming.
|
||||
@autoreleasepool {
|
||||
NSError *error = nil;
|
||||
|
||||
NSString * oldPath = [info[SUInstallerHostKey] bundlePath];
|
||||
NSString * installationPath = info[SUInstallerInstallationPathKey];
|
||||
BOOL result = [self copyPathWithAuthentication:info[SUInstallerPathKey] overPath: installationPath temporaryName:info[SUInstallerTempNameKey] error:&error];
|
||||
|
||||
if( result )
|
||||
{
|
||||
BOOL haveOld = [[NSFileManager defaultManager] fileExistsAtPath: oldPath];
|
||||
BOOL differentFromNew = ![oldPath isEqualToString: installationPath];
|
||||
if( haveOld && differentFromNew )
|
||||
[self _movePathToTrash: oldPath]; // On success, trash old copy if there's still one due to renaming.
|
||||
}
|
||||
NSMutableDictionary *mutableInfo = [[info mutableCopy] autorelease];
|
||||
mutableInfo[SUInstallerResultKey] = @(result);
|
||||
mutableInfo[SUInstallerInstallationPathKey] = installationPath;
|
||||
if (!result && error)
|
||||
mutableInfo[SUInstallerErrorKey] = error;
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self finishInstallationWithInfo:mutableInfo];
|
||||
});
|
||||
}
|
||||
NSMutableDictionary *mutableInfo = [[info mutableCopy] autorelease];
|
||||
[mutableInfo setObject:[NSNumber numberWithBool:result] forKey:SUInstallerResultKey];
|
||||
[mutableInfo setObject:installationPath forKey:SUInstallerInstallationPathKey];
|
||||
if (!result && error)
|
||||
[mutableInfo setObject:error forKey:SUInstallerErrorKey];
|
||||
[self performSelectorOnMainThread:@selector(finishInstallationWithInfo:) withObject:mutableInfo waitUntilDone:NO];
|
||||
|
||||
[pool drain];
|
||||
}
|
||||
|
||||
+ (void)performInstallationToPath:(NSString *)installationPath fromPath:(NSString *)path host:(SUHost *)host delegate:delegate synchronously:(BOOL)synchronously versionComparator:(id <SUVersionComparison>)comparator
|
||||
@@ -65,7 +65,7 @@ static NSString * const SUInstallerInstallationPathKey = @"SUInstallerInstallati
|
||||
if ([comparator compareVersion:[host version] toVersion:[[NSBundle bundleWithPath:path] objectForInfoDictionaryKey:@"CFBundleVersion"]] == NSOrderedDescending)
|
||||
{
|
||||
NSString * errorMessage = [NSString stringWithFormat:@"Sparkle Updater: Possible attack in progress! Attempting to \"upgrade\" from %@ to %@. Aborting update.", [host version], [[NSBundle bundleWithPath:path] objectForInfoDictionaryKey:@"CFBundleVersion"]];
|
||||
NSError *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUDowngradeError userInfo:[NSDictionary dictionaryWithObject:errorMessage forKey:NSLocalizedDescriptionKey]];
|
||||
NSError *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUDowngradeError userInfo:@{NSLocalizedDescriptionKey: errorMessage}];
|
||||
[self finishInstallationToPath:installationPath withResult:NO host:host error:error delegate:delegate];
|
||||
return;
|
||||
}
|
||||
@@ -73,11 +73,14 @@ static NSString * const SUInstallerInstallationPathKey = @"SUInstallerInstallati
|
||||
|
||||
NSString *targetPath = [host installationPath];
|
||||
NSString *tempName = [self temporaryNameForPath:targetPath];
|
||||
NSDictionary *info = [NSDictionary dictionaryWithObjectsAndKeys:path, SUInstallerPathKey, targetPath, SUInstallerTargetPathKey, tempName, SUInstallerTempNameKey, host, SUInstallerHostKey, delegate, SUInstallerDelegateKey, installationPath, SUInstallerInstallationPathKey, nil];
|
||||
NSDictionary *info = @{SUInstallerPathKey: path, SUInstallerTargetPathKey: targetPath, SUInstallerTempNameKey: tempName, SUInstallerHostKey: host, SUInstallerDelegateKey: delegate, SUInstallerInstallationPathKey: installationPath};
|
||||
if (synchronously)
|
||||
[self performInstallationWithInfo:info];
|
||||
else
|
||||
[NSThread detachNewThreadSelector:@selector(performInstallationWithInfo:) toTarget:self withObject:info];
|
||||
else {
|
||||
dispatch_async(dispatch_get_global_queue(0, 0), ^{
|
||||
[self performInstallationWithInfo:info];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
+77
-104
@@ -15,14 +15,22 @@
|
||||
#import "SUConstants.h"
|
||||
#import "SULog.h"
|
||||
|
||||
#import <CoreServices/CoreServices.h>
|
||||
#import <Security/Security.h>
|
||||
#import <sys/stat.h>
|
||||
#import <sys/wait.h>
|
||||
#import <dirent.h>
|
||||
#import <unistd.h>
|
||||
#import <sys/param.h>
|
||||
#include <CoreServices/CoreServices.h>
|
||||
#include <Security/Security.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/wait.h>
|
||||
#include <dirent.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
static inline void PerformOnMainThreadSync(dispatch_block_t theBlock)
|
||||
{
|
||||
if ([NSThread isMainThread]) {
|
||||
theBlock();
|
||||
} else {
|
||||
dispatch_sync(dispatch_get_main_queue(), theBlock);
|
||||
}
|
||||
}
|
||||
|
||||
@interface SUPlainInstaller (MMExtendedAttributes)
|
||||
// Removes the directory tree rooted at |root| from the file quarantine.
|
||||
@@ -47,7 +55,8 @@
|
||||
@end
|
||||
|
||||
// Authorization code based on generous contribution from Allan Odgaard. Thanks, Allan!
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations" // this is terrible; will fix later probably
|
||||
static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authorization, const char* executablePath, AuthorizationFlags options, const char* const* arguments)
|
||||
{
|
||||
// *** MUST BE SAFE TO CALL ON NON-MAIN THREAD!
|
||||
@@ -68,6 +77,7 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
|
||||
signal(SIGCHLD, oldSigChildHandler);
|
||||
return returnValue;
|
||||
}
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
@implementation SUPlainInstaller (Internals)
|
||||
|
||||
@@ -78,9 +88,7 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
|
||||
NSString *version;
|
||||
if ((version = [[NSBundle bundleWithPath:path] objectForInfoDictionaryKey:@"CFBundleVersion"]) && ![version isEqualToString:@""])
|
||||
{
|
||||
// We'll clean it up a little for safety.
|
||||
// The cast is necessary because of a bug in the headers in pre-10.5 SDKs
|
||||
NSMutableCharacterSet *validCharacters = (id)[NSMutableCharacterSet alphanumericCharacterSet];
|
||||
NSMutableCharacterSet *validCharacters = [NSMutableCharacterSet alphanumericCharacterSet];
|
||||
[validCharacters formUnionWithCharacterSet:[NSCharacterSet characterSetWithCharactersInString:@".-()"]];
|
||||
postFix = [version stringByTrimmingCharactersInSet:[validCharacters invertedSet]];
|
||||
}
|
||||
@@ -132,14 +140,13 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
|
||||
NSString *version = nil;
|
||||
if ((version = [[NSBundle bundleWithPath: path] objectForInfoDictionaryKey:@"CFBundleVersion"]) && ![version isEqualToString:@""])
|
||||
{
|
||||
// We'll clean it up a little for safety.
|
||||
// The cast is necessary because of a bug in the headers in pre-10.5 SDKs
|
||||
NSMutableCharacterSet *validCharacters = (id)[NSMutableCharacterSet alphanumericCharacterSet];
|
||||
NSMutableCharacterSet *validCharacters = [NSMutableCharacterSet alphanumericCharacterSet];
|
||||
[validCharacters formUnionWithCharacterSet:[NSCharacterSet characterSetWithCharactersInString:@".-()"]];
|
||||
postFix = [version stringByTrimmingCharactersInSet:[validCharacters invertedSet]];
|
||||
}
|
||||
else
|
||||
else {
|
||||
postFix = @"old";
|
||||
}
|
||||
NSString *prefix = [NSString stringWithFormat: @"%@ (%@)", [[path lastPathComponent] stringByDeletingPathExtension], postFix];
|
||||
#else
|
||||
NSString *prefix = [[path lastPathComponent] stringByDeletingPathExtension];
|
||||
@@ -149,8 +156,9 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
|
||||
|
||||
// Now let's make sure we get a unique path.
|
||||
int cnt=2;
|
||||
while ([[NSFileManager defaultManager] fileExistsAtPath:tempDir] && cnt <= 9999)
|
||||
while ([[NSFileManager defaultManager] fileExistsAtPath:tempDir] && cnt <= 9999) {
|
||||
tempDir = [[tempDir stringByDeletingLastPathComponent] stringByAppendingPathComponent: [NSString stringWithFormat:@"%@ %d.%@", prefix, cnt++, [path pathExtension]]];
|
||||
}
|
||||
|
||||
return tempDir;
|
||||
}
|
||||
@@ -171,7 +179,7 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
|
||||
{
|
||||
NSString *errorMessage = [NSString stringWithFormat:@"Stat on %@ during authenticated file copy failed.", dst];
|
||||
if (error != NULL)
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUFileCopyFailure userInfo:[NSDictionary dictionaryWithObject:errorMessage forKey:NSLocalizedDescriptionKey]];
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUFileCopyFailure userInfo:@{NSLocalizedDescriptionKey: errorMessage}];
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
@@ -198,12 +206,19 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
|
||||
// quarantine to avoid a delay at launch, and to avoid
|
||||
// presenting the user with a confusing trust dialog.
|
||||
//
|
||||
// This needs to be done before "chown" changes ownership,
|
||||
// because the ownership change will fail if the file is quarantined.
|
||||
// This needs to be done after the application is moved to its
|
||||
// new home with "mv" in case it's moved across filesystems: if
|
||||
// that happens, "mv" actually performs a copy and may result
|
||||
// in the application being quarantined. It also needs to be
|
||||
// done before "chown" changes ownership, because the ownership
|
||||
// change will almost certainly make it impossible to change
|
||||
// attributes to release the files from the quarantine.
|
||||
if (res)
|
||||
{
|
||||
SULog(@"releaseFromQuarantine");
|
||||
[self performSelectorOnMainThread:@selector(releaseFromQuarantine:) withObject:src waitUntilDone:YES];
|
||||
PerformOnMainThreadSync(^{
|
||||
[self releaseFromQuarantine:src];
|
||||
});
|
||||
}
|
||||
|
||||
if( res ) // Set permissions while it's still in source, so we have it with working and correct perms when it arrives at destination.
|
||||
@@ -259,7 +274,9 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
|
||||
if (res)
|
||||
{
|
||||
SULog(@"releaseFromQuarantine after installing");
|
||||
[self performSelectorOnMainThread:@selector(releaseFromQuarantine:) withObject:dst waitUntilDone:YES];
|
||||
PerformOnMainThreadSync(^{
|
||||
[self releaseFromQuarantine:dst];
|
||||
});
|
||||
}
|
||||
|
||||
if (!res)
|
||||
@@ -267,13 +284,13 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
|
||||
// Something went wrong somewhere along the way, but we're not sure exactly where.
|
||||
NSString *errorMessage = [NSString stringWithFormat:@"Authenticated file copy from %@ to %@ failed.", src, dst];
|
||||
if (error != nil)
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUAuthenticationFailure userInfo:[NSDictionary dictionaryWithObject:errorMessage forKey:NSLocalizedDescriptionKey]];
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUAuthenticationFailure userInfo:@{NSLocalizedDescriptionKey: errorMessage}];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (error != nil)
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUAuthenticationFailure userInfo:[NSDictionary dictionaryWithObject:@"Couldn't get permission to authenticate." forKey:NSLocalizedDescriptionKey]];
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUAuthenticationFailure userInfo:@{NSLocalizedDescriptionKey: @"Couldn't get permission to authenticate."}];
|
||||
}
|
||||
return res;
|
||||
}
|
||||
@@ -340,13 +357,13 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
|
||||
// Something went wrong somewhere along the way, but we're not sure exactly where.
|
||||
NSString *errorMessage = [NSString stringWithFormat:@"Authenticated file move from %@ to %@ failed.", src, dst];
|
||||
if (error != NULL)
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUAuthenticationFailure userInfo:[NSDictionary dictionaryWithObject:errorMessage forKey:NSLocalizedDescriptionKey]];
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUAuthenticationFailure userInfo:@{NSLocalizedDescriptionKey: errorMessage}];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (error != NULL)
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUAuthenticationFailure userInfo:[NSDictionary dictionaryWithObject:@"Couldn't get permission to authenticate." forKey:NSLocalizedDescriptionKey]];
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUAuthenticationFailure userInfo:@{NSLocalizedDescriptionKey: @"Couldn't get permission to authenticate."}];
|
||||
}
|
||||
return res;
|
||||
}
|
||||
@@ -388,13 +405,13 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
|
||||
// Something went wrong somewhere along the way, but we're not sure exactly where.
|
||||
NSString *errorMessage = [NSString stringWithFormat:@"Authenticated file remove from %@ failed.", src];
|
||||
if (error != NULL)
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUAuthenticationFailure userInfo:[NSDictionary dictionaryWithObject:errorMessage forKey:NSLocalizedDescriptionKey]];
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUAuthenticationFailure userInfo:@{NSLocalizedDescriptionKey: errorMessage}];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (error != NULL)
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUAuthenticationFailure userInfo:[NSDictionary dictionaryWithObject:@"Couldn't get permission to authenticate." forKey:NSLocalizedDescriptionKey]];
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUAuthenticationFailure userInfo:@{NSLocalizedDescriptionKey: @"Couldn't get permission to authenticate."}];
|
||||
}
|
||||
return res;
|
||||
}
|
||||
@@ -402,11 +419,7 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
|
||||
+ (BOOL)_removeFileAtPath:(NSString *)path error: (NSError**)error
|
||||
{
|
||||
BOOL success = YES;
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4
|
||||
if( ![[NSFileManager defaultManager] removeFileAtPath: path handler: nil] )
|
||||
#else
|
||||
if( ![[NSFileManager defaultManager] removeItemAtPath: path error: NULL] )
|
||||
#endif
|
||||
{
|
||||
success = [self _removeFileAtPathWithForcedAuthentication: path error: error];
|
||||
}
|
||||
@@ -418,7 +431,7 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
|
||||
{
|
||||
//SULog(@"Moving %@ to the trash.", path);
|
||||
NSInteger tag = 0;
|
||||
if (![[NSWorkspace sharedWorkspace] performFileOperation:NSWorkspaceRecycleOperation source:[path stringByDeletingLastPathComponent] destination:@"" files:[NSArray arrayWithObject:[path lastPathComponent]] tag:&tag])
|
||||
if (![[NSWorkspace sharedWorkspace] performFileOperation:NSWorkspaceRecycleOperation source:[path stringByDeletingLastPathComponent] destination:@"" files:@[[path lastPathComponent]] tag:&tag])
|
||||
{
|
||||
BOOL didFindTrash = NO;
|
||||
NSString* trashPath = [self _temporaryCopyNameForPath: path didFindTrash: &didFindTrash];
|
||||
@@ -437,7 +450,7 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
|
||||
|
||||
+ (BOOL)copyPathWithAuthentication:(NSString *)src overPath:(NSString *)dst temporaryName:(NSString *)tmp error:(NSError **)error
|
||||
{
|
||||
FSRef srcRef, dstRef, dstDirRef, movedRef, tmpDirRef;
|
||||
FSRef srcRef, dstRef, dstDirRef, tmpDirRef;
|
||||
OSStatus err;
|
||||
BOOL hadFileAtDest = NO, didFindTrash = NO;
|
||||
NSString *tmpPath = [self _temporaryCopyNameForPath: dst didFindTrash: &didFindTrash];
|
||||
@@ -465,66 +478,41 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
|
||||
{
|
||||
err = FSPathMakeRef((UInt8 *)[[tmpPath stringByDeletingLastPathComponent] fileSystemRepresentation], &tmpDirRef, NULL);
|
||||
if (err != noErr)
|
||||
err = FSPathMakeRef((UInt8 *)[[dst stringByDeletingLastPathComponent] fileSystemRepresentation], &tmpDirRef, NULL);
|
||||
FSPathMakeRef((UInt8 *)[[dst stringByDeletingLastPathComponent] fileSystemRepresentation], &tmpDirRef, NULL);
|
||||
}
|
||||
|
||||
err = FSPathMakeRef((UInt8 *)[[dst stringByDeletingLastPathComponent] fileSystemRepresentation], &dstDirRef, NULL);
|
||||
|
||||
|
||||
if (err == noErr && hadFileAtDest)
|
||||
{
|
||||
if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_5)
|
||||
{
|
||||
NSFileManager *manager = [[[NSFileManager alloc] init] autorelease];
|
||||
BOOL success = [manager moveItemAtPath:dst toPath:tmpPath error:error];
|
||||
if (!success && hadFileAtDest)
|
||||
{
|
||||
if (error != NULL)
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUFileCopyFailure userInfo:[NSDictionary dictionaryWithObject:[NSString stringWithFormat:@"Couldn't move %@ to %@.", dst, tmpPath] forKey:NSLocalizedDescriptionKey]];
|
||||
return NO;
|
||||
}
|
||||
|
||||
} else {
|
||||
err = FSMoveObjectSync(&dstRef, &tmpDirRef, (CFStringRef)[tmpPath lastPathComponent], &movedRef, 0);
|
||||
if (err != noErr && hadFileAtDest)
|
||||
{
|
||||
if (error != NULL)
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUFileCopyFailure userInfo:[NSDictionary dictionaryWithObject:[NSString stringWithFormat:@"Couldn't move %@ to %@.", dst, tmpPath] forKey:NSLocalizedDescriptionKey]];
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
{
|
||||
NSFileManager *manager = [[[NSFileManager alloc] init] autorelease];
|
||||
BOOL success = [manager moveItemAtPath:dst toPath:tmpPath error:error];
|
||||
if (!success && hadFileAtDest)
|
||||
{
|
||||
if (error != NULL)
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUFileCopyFailure userInfo:@{NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Couldn't move %@ to %@.", dst, tmpPath]}];
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
err = FSPathMakeRef((UInt8 *)[src fileSystemRepresentation], &srcRef, NULL);
|
||||
if (err == noErr)
|
||||
{
|
||||
if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_5)
|
||||
NSFileManager *manager = [[[NSFileManager alloc] init] autorelease];
|
||||
BOOL success = [manager copyItemAtPath:src toPath:dst error:error];
|
||||
if (!success)
|
||||
{
|
||||
NSFileManager *manager = [[[NSFileManager alloc] init] autorelease];
|
||||
BOOL success = [manager copyItemAtPath:src toPath:dst error:error];
|
||||
if (!success)
|
||||
{
|
||||
// We better move the old version back to its old location
|
||||
if( hadFileAtDest )
|
||||
success = [manager moveItemAtPath:tmpPath toPath:dst error:error];
|
||||
if (error != NULL)
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUFileCopyFailure userInfo:[NSDictionary dictionaryWithObject:[NSString stringWithFormat:@"Couldn't move %@ to %@.", dst, tmpPath] forKey:NSLocalizedDescriptionKey]];
|
||||
return NO;
|
||||
// We better move the old version back to its old location
|
||||
if (hadFileAtDest) {
|
||||
success = [manager moveItemAtPath:tmpPath toPath:dst error:error];
|
||||
}
|
||||
if (!success && error != NULL)
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUFileCopyFailure userInfo:@{NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Couldn't move %@ to %@.", dst, tmpPath]}];
|
||||
return NO;
|
||||
|
||||
}
|
||||
} else {
|
||||
err = FSCopyObjectSync(&srcRef, &dstDirRef, (CFStringRef)[dst lastPathComponent], NULL, 0);
|
||||
if (err != noErr)
|
||||
{
|
||||
// We better move the old version back to its old location
|
||||
if( hadFileAtDest )
|
||||
FSMoveObjectSync(&movedRef, &dstDirRef, (CFStringRef)[dst lastPathComponent], &movedRef, 0);
|
||||
if (error != NULL)
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUFileCopyFailure userInfo:[NSDictionary dictionaryWithObject:[NSString stringWithFormat:@"Couldn't copy %@ to %@.", src, dst] forKey:NSLocalizedDescriptionKey]];
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// If the currently-running application is trusted, the new
|
||||
// version should be trusted as well. Remove it from the
|
||||
// quarantine to avoid a delay at launch, and to avoid
|
||||
@@ -534,16 +522,18 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
|
||||
// new home in case it's moved across filesystems: if that
|
||||
// happens, the move is actually a copy, and it may result
|
||||
// in the application being quarantined.
|
||||
[self performSelectorOnMainThread:@selector(releaseFromQuarantine:) withObject:dst waitUntilDone:YES];
|
||||
PerformOnMainThreadSync(^{
|
||||
[self releaseFromQuarantine:dst];
|
||||
});
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#import <dlfcn.h>
|
||||
#import <errno.h>
|
||||
#import <sys/xattr.h>
|
||||
#include <dlfcn.h>
|
||||
#include <errno.h>
|
||||
#include <sys/xattr.h>
|
||||
|
||||
@implementation SUPlainInstaller (MMExtendedAttributes)
|
||||
|
||||
@@ -553,19 +543,6 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
|
||||
{
|
||||
// *** MUST BE SAFE TO CALL ON NON-MAIN THREAD!
|
||||
|
||||
typedef int (*removexattr_type)(const char*, const char*, int);
|
||||
// Reference removexattr directly, it's in the SDK.
|
||||
static removexattr_type removexattr_func = removexattr;
|
||||
|
||||
// Make sure that the symbol is present. This checks the deployment
|
||||
// target instead of the SDK so that it's able to catch dlsym failures
|
||||
// as well as the null symbol that would result from building with the
|
||||
// 10.4 SDK and a lower deployment target, and running on 10.3.
|
||||
if (!removexattr_func) {
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
const char* path = NULL;
|
||||
@try {
|
||||
path = [file fileSystemRepresentation];
|
||||
@@ -579,7 +556,7 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
|
||||
return -1;
|
||||
}
|
||||
|
||||
return removexattr_func(path, name, options);
|
||||
return removexattr(path, name, options);
|
||||
}
|
||||
|
||||
+ (void)releaseFromQuarantine:(NSString*)root
|
||||
@@ -595,12 +572,8 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
|
||||
|
||||
// Only recurse if it's actually a directory. Don't recurse into a
|
||||
// root-level symbolic link.
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4
|
||||
NSDictionary* rootAttributes = [[NSFileManager defaultManager] fileAttributesAtPath:root traverseLink:NO];
|
||||
#else
|
||||
NSDictionary* rootAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:root error:nil];
|
||||
#endif
|
||||
NSString* rootType = [rootAttributes objectForKey:NSFileType];
|
||||
NSString* rootType = rootAttributes[NSFileType];
|
||||
|
||||
if (rootType == NSFileTypeDirectory) {
|
||||
// The NSDirectoryEnumerator will avoid recursing into any contained
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#import "SUBasicUpdateDriver.h"
|
||||
|
||||
// This replaces the old SUStatusChecker.
|
||||
@interface SUProbingUpdateDriver : SUBasicUpdateDriver { }
|
||||
@interface SUProbingUpdateDriver : SUBasicUpdateDriver
|
||||
@end
|
||||
|
||||
#endif
|
||||
@@ -17,13 +17,18 @@
|
||||
{
|
||||
if ([[updater delegate] respondsToSelector:@selector(updater:didFindValidUpdate:)])
|
||||
[[updater delegate] updater:updater didFindValidUpdate:updateItem];
|
||||
NSDictionary *userInfo = (updateItem != nil) ? @{SUUpdaterAppcastItemNotificationKey : updateItem} : nil;
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:SUUpdaterDidFindValidUpdateNotification object:updater userInfo:userInfo];
|
||||
[self abortUpdate];
|
||||
}
|
||||
|
||||
- (void)didNotFindUpdate
|
||||
{
|
||||
if ([[updater delegate] respondsToSelector:@selector(updaterDidNotFindUpdate:)])
|
||||
if ([[updater delegate] respondsToSelector:@selector(updaterDidNotFindUpdate:)]) {
|
||||
[[updater delegate] updaterDidNotFindUpdate:updater];
|
||||
}
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:SUUpdaterDidNotFindUpdateNotification object:updater];
|
||||
|
||||
[self abortUpdate];
|
||||
}
|
||||
|
||||
|
||||
@@ -23,8 +23,11 @@
|
||||
|
||||
- (void)didNotFindUpdate
|
||||
{
|
||||
if ([[updater delegate] respondsToSelector:@selector(updaterDidNotFindUpdate:)])
|
||||
if ([[updater delegate] respondsToSelector:@selector(updaterDidNotFindUpdate:)]) {
|
||||
[[updater delegate] updaterDidNotFindUpdate:updater];
|
||||
}
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:SUUpdaterDidNotFindUpdateNotification object:updater];
|
||||
|
||||
[self abortUpdate]; // Don't tell the user that no update was found; this was a scheduled update.
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
@abstract Sparkle's default version comparator.
|
||||
@discussion This comparator is adapted from MacPAD, by Kevin Ballard. It's "dumb" in that it does essentially string comparison, in components split by character type.
|
||||
*/
|
||||
@interface SUStandardVersionComparator : NSObject <SUVersionComparison> { }
|
||||
@interface SUStandardVersionComparator : NSObject <SUVersionComparison>
|
||||
|
||||
/*!
|
||||
@method
|
||||
|
||||
@@ -18,8 +18,9 @@
|
||||
+ (SUStandardVersionComparator *)defaultComparator
|
||||
{
|
||||
static SUStandardVersionComparator *defaultComparator = nil;
|
||||
if (defaultComparator == nil)
|
||||
if (defaultComparator == nil) {
|
||||
defaultComparator = [[SUStandardVersionComparator alloc] init];
|
||||
}
|
||||
return defaultComparator;
|
||||
}
|
||||
|
||||
@@ -90,8 +91,8 @@ typedef enum {
|
||||
|
||||
n = MIN([partsA count], [partsB count]);
|
||||
for (i = 0; i < n; ++i) {
|
||||
partA = [partsA objectAtIndex:i];
|
||||
partB = [partsB objectAtIndex:i];
|
||||
partA = partsA[i];
|
||||
partB = partsB[i];
|
||||
|
||||
typeA = [self typeOfCharacter:partA];
|
||||
typeB = [self typeOfCharacter:partB];
|
||||
@@ -141,11 +142,11 @@ typedef enum {
|
||||
NSComparisonResult shorterResult, largerResult;
|
||||
|
||||
if ([partsA count] > [partsB count]) {
|
||||
missingPart = [partsA objectAtIndex:n];
|
||||
missingPart = partsA[n];
|
||||
shorterResult = NSOrderedAscending;
|
||||
largerResult = NSOrderedDescending;
|
||||
} else {
|
||||
missingPart = [partsB objectAtIndex:n];
|
||||
missingPart = partsB[n];
|
||||
shorterResult = NSOrderedDescending;
|
||||
largerResult = NSOrderedAscending;
|
||||
}
|
||||
|
||||
+9
-18
@@ -13,31 +13,22 @@
|
||||
|
||||
@class SUHost;
|
||||
@interface SUStatusController : SUWindowController
|
||||
{
|
||||
@private
|
||||
double progressValue, maxProgressValue;
|
||||
NSString *title, *statusText, *buttonTitle;
|
||||
IBOutlet NSButton *actionButton;
|
||||
IBOutlet NSProgressIndicator* progressBar;
|
||||
SUHost *host;
|
||||
}
|
||||
@property (assign) IBOutlet NSButton *actionButton;
|
||||
@property (assign) IBOutlet NSProgressIndicator* progressBar;
|
||||
|
||||
- (id)initWithHost:(SUHost *)host;
|
||||
@property (copy) NSString *statusText;
|
||||
@property double progressValue;
|
||||
@property (nonatomic) double maxProgressValue;
|
||||
@property (getter = isButtonEnabled) BOOL buttonEnabled;
|
||||
|
||||
- (instancetype)initWithHost:(SUHost *)host;
|
||||
|
||||
// Pass 0 for the max progress value to get an indeterminate progress bar.
|
||||
// Pass nil for the status text to not show it.
|
||||
- (void)beginActionWithTitle:(NSString *)title maxProgressValue:(double)maxProgressValue statusText:(NSString *)statusText;
|
||||
|
||||
// If isDefault is YES, the button's key equivalent will be \r.
|
||||
- (void)setButtonTitle:(NSString *)buttonTitle target:target action:(SEL)action isDefault:(BOOL)isDefault;
|
||||
- (void)setButtonEnabled:(BOOL)enabled;
|
||||
|
||||
- (double)progressValue;
|
||||
- (void)setProgressValue:(double)value;
|
||||
- (double)maxProgressValue;
|
||||
- (void)setMaxProgressValue:(double)value;
|
||||
|
||||
- (void)setStatusText:(NSString *)statusText;
|
||||
- (void)setButtonTitle:(NSString *)buttonTitle target:(id)target action:(SEL)action isDefault:(BOOL)isDefault;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
+25
-40
@@ -14,15 +14,27 @@
|
||||
#import "SUStatusController.h"
|
||||
#import "SUHost.h"
|
||||
|
||||
@interface SUStatusController ()
|
||||
@property (copy) NSString *title, *buttonTitle;
|
||||
@property (retain) SUHost *host;
|
||||
@end
|
||||
|
||||
@implementation SUStatusController
|
||||
@synthesize progressValue;
|
||||
@synthesize maxProgressValue;
|
||||
@synthesize statusText;
|
||||
@synthesize title;
|
||||
@synthesize buttonTitle;
|
||||
@synthesize host;
|
||||
@synthesize actionButton;
|
||||
@synthesize progressBar;
|
||||
|
||||
- (id)initWithHost:(SUHost *)aHost
|
||||
- (instancetype)initWithHost:(SUHost *)aHost
|
||||
{
|
||||
self = [super initWithHost:aHost windowNibName:@"SUStatus"];
|
||||
if (self)
|
||||
{
|
||||
host = [aHost retain];
|
||||
self.host = aHost;
|
||||
[self setShouldCascadeWindows:NO];
|
||||
}
|
||||
return self;
|
||||
@@ -30,10 +42,10 @@
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[host release];
|
||||
[title release];
|
||||
[statusText release];
|
||||
[buttonTitle release];
|
||||
self.host = nil;
|
||||
self.title = nil;
|
||||
self.statusText = nil;
|
||||
self.buttonTitle = nil;
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
@@ -62,23 +74,15 @@
|
||||
|
||||
- (void)beginActionWithTitle:(NSString *)aTitle maxProgressValue:(double)aMaxProgressValue statusText:(NSString *)aStatusText
|
||||
{
|
||||
[self willChangeValueForKey:@"title"];
|
||||
title = [aTitle copy];
|
||||
[self didChangeValueForKey:@"title"];
|
||||
self.title = aTitle;
|
||||
|
||||
[self setMaxProgressValue:aMaxProgressValue];
|
||||
[self setStatusText:aStatusText];
|
||||
self.maxProgressValue = aMaxProgressValue;
|
||||
self.statusText = aStatusText;
|
||||
}
|
||||
|
||||
- (void)setButtonTitle:(NSString *)aButtonTitle target: (id)target action:(SEL)action isDefault:(BOOL)isDefault
|
||||
- (void)setButtonTitle:(NSString *)aButtonTitle target:(id)target action:(SEL)action isDefault:(BOOL)isDefault
|
||||
{
|
||||
[self willChangeValueForKey:@"buttonTitle"];
|
||||
if (buttonTitle != aButtonTitle)
|
||||
{
|
||||
[buttonTitle release];
|
||||
buttonTitle = [aButtonTitle copy];
|
||||
}
|
||||
[self didChangeValueForKey:@"buttonTitle"];
|
||||
self.buttonTitle = aButtonTitle;
|
||||
|
||||
[self window];
|
||||
[actionButton sizeToFit];
|
||||
@@ -107,19 +111,9 @@
|
||||
[actionButton setEnabled:enabled];
|
||||
}
|
||||
|
||||
- (double)progressValue
|
||||
- (BOOL)isButtonEnabled
|
||||
{
|
||||
return progressValue;
|
||||
}
|
||||
|
||||
- (void)setProgressValue:(double)value
|
||||
{
|
||||
progressValue = value;
|
||||
}
|
||||
|
||||
- (double)maxProgressValue
|
||||
{
|
||||
return maxProgressValue;
|
||||
return [actionButton isEnabled];
|
||||
}
|
||||
|
||||
- (void)setMaxProgressValue:(double)value
|
||||
@@ -132,13 +126,4 @@
|
||||
[progressBar setUsesThreadedAnimation: YES];
|
||||
}
|
||||
|
||||
- (void)setStatusText:(NSString *)aStatusText
|
||||
{
|
||||
if (statusText != aStatusText)
|
||||
{
|
||||
[statusText release];
|
||||
statusText = [aStatusText copy];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
+1
-1
@@ -12,7 +12,7 @@
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@class SUHost;
|
||||
@interface SUSystemProfiler : NSObject {}
|
||||
@interface SUSystemProfiler : NSObject
|
||||
+ (SUSystemProfiler *)sharedSystemProfiler;
|
||||
- (NSMutableArray *)systemProfileArrayForHost:(SUHost *)host;
|
||||
@end
|
||||
|
||||
+45
-29
@@ -10,14 +10,15 @@
|
||||
#import "SUSystemProfiler.h"
|
||||
|
||||
#import "SUHost.h"
|
||||
#import <sys/sysctl.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
@implementation SUSystemProfiler
|
||||
+ (SUSystemProfiler *)sharedSystemProfiler
|
||||
{
|
||||
static SUSystemProfiler *sharedSystemProfiler = nil;
|
||||
if (!sharedSystemProfiler)
|
||||
if (!sharedSystemProfiler) {
|
||||
sharedSystemProfiler = [[self alloc] init];
|
||||
}
|
||||
return sharedSystemProfiler;
|
||||
}
|
||||
|
||||
@@ -33,15 +34,16 @@
|
||||
|
||||
// Gather profile information and append it to the URL.
|
||||
NSMutableArray *profileArray = [NSMutableArray array];
|
||||
NSArray *profileDictKeys = [NSArray arrayWithObjects:@"key", @"displayKey", @"value", @"displayValue", nil];
|
||||
NSArray *profileDictKeys = @[@"key", @"displayKey", @"value", @"displayValue"];
|
||||
int error = 0;
|
||||
int value = 0;
|
||||
size_t length = sizeof(value);
|
||||
|
||||
// OS version
|
||||
NSString *currentSystemVersion = [SUHost systemVersionString];
|
||||
if (currentSystemVersion != nil)
|
||||
[profileArray addObject:[NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"osVersion",@"OS Version",currentSystemVersion,currentSystemVersion,nil] forKeys:profileDictKeys]];
|
||||
if (currentSystemVersion != nil) {
|
||||
[profileArray addObject:[NSDictionary dictionaryWithObjects:@[@"osVersion",@"OS Version",currentSystemVersion,currentSystemVersion] forKeys:profileDictKeys]];
|
||||
}
|
||||
|
||||
// CPU type (decoder info for values found here is in mach/machine.h)
|
||||
error = sysctlbyname("hw.cputype", &value, &length, NULL, 0);
|
||||
@@ -54,25 +56,28 @@
|
||||
case CPU_TYPE_POWERPC: visibleCPUType = @"PowerPC"; break;
|
||||
default: visibleCPUType = @"Unknown"; break;
|
||||
}
|
||||
[profileArray addObject:[NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"cputype",@"CPU Type", [NSNumber numberWithInt:value], visibleCPUType,nil] forKeys:profileDictKeys]];
|
||||
[profileArray addObject:[NSDictionary dictionaryWithObjects:@[@"cputype",@"CPU Type", @(value), visibleCPUType] forKeys:profileDictKeys]];
|
||||
}
|
||||
error = sysctlbyname("hw.cpu64bit_capable", &value, &length, NULL, 0);
|
||||
if(error != 0)
|
||||
if (error != 0) {
|
||||
error = sysctlbyname("hw.optional.x86_64", &value, &length, NULL, 0); //x86 specific
|
||||
if(error != 0)
|
||||
}
|
||||
if (error != 0) {
|
||||
error = sysctlbyname("hw.optional.64bitops", &value, &length, NULL, 0); //PPC specific
|
||||
}
|
||||
|
||||
BOOL is64bit = NO;
|
||||
|
||||
if (error == 0) {
|
||||
is64bit = value == 1;
|
||||
[profileArray addObject:[NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"cpu64bit", @"CPU is 64-Bit?", [NSNumber numberWithBool:is64bit], is64bit ? @"Yes" : @"No", nil] forKeys:profileDictKeys]];
|
||||
[profileArray addObject:[NSDictionary dictionaryWithObjects:@[@"cpu64bit", @"CPU is 64-Bit?", @(is64bit), is64bit ? @"Yes" : @"No"] forKeys:profileDictKeys]];
|
||||
}
|
||||
error = sysctlbyname("hw.cpusubtype", &value, &length, NULL, 0);
|
||||
if (error == 0) {
|
||||
NSString *visibleCPUSubType;
|
||||
if (cpuType == 7) {
|
||||
// Intel
|
||||
// TODO: other Intel processors, like Core i7, i5, i3, Xeon?
|
||||
visibleCPUSubType = is64bit ? @"Intel Core 2" : @"Intel Core"; // If anyone knows how to tell a Core Duo from a Core Solo, please email tph@atomicbird.com
|
||||
} else if (cpuType == 18) {
|
||||
// PowerPC
|
||||
@@ -85,7 +90,7 @@
|
||||
} else {
|
||||
visibleCPUSubType = @"Other";
|
||||
}
|
||||
[profileArray addObject:[NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"cpusubtype",@"CPU Subtype", [NSNumber numberWithInt:value], visibleCPUSubType,nil] forKeys:profileDictKeys]];
|
||||
[profileArray addObject:[NSDictionary dictionaryWithObjects:@[@"cpusubtype",@"CPU Subtype", @(value), visibleCPUSubType] forKeys:profileDictKeys]];
|
||||
}
|
||||
error = sysctlbyname("hw.model", NULL, &length, NULL, 0);
|
||||
if (error == 0) {
|
||||
@@ -93,11 +98,12 @@
|
||||
if (cpuModel != NULL) {
|
||||
error = sysctlbyname("hw.model", cpuModel, &length, NULL, 0);
|
||||
if (error == 0) {
|
||||
NSString *rawModelName = [NSString stringWithUTF8String:cpuModel];
|
||||
NSString *visibleModelName = [modelTranslation objectForKey:rawModelName];
|
||||
if (visibleModelName == nil)
|
||||
NSString *rawModelName = @(cpuModel);
|
||||
NSString *visibleModelName = modelTranslation[rawModelName];
|
||||
if (visibleModelName == nil) {
|
||||
visibleModelName = rawModelName;
|
||||
[profileArray addObject:[NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"model",@"Mac Model", rawModelName, visibleModelName, nil] forKeys:profileDictKeys]];
|
||||
}
|
||||
[profileArray addObject:[NSDictionary dictionaryWithObjects:@[@"model",@"Mac Model", rawModelName, visibleModelName] forKeys:profileDictKeys]];
|
||||
}
|
||||
free(cpuModel);
|
||||
}
|
||||
@@ -105,34 +111,44 @@
|
||||
|
||||
// Number of CPUs
|
||||
error = sysctlbyname("hw.ncpu", &value, &length, NULL, 0);
|
||||
if (error == 0)
|
||||
[profileArray addObject:[NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"ncpu",@"Number of CPUs", [NSNumber numberWithInt:value], [NSNumber numberWithInt:value],nil] forKeys:profileDictKeys]];
|
||||
if (error == 0) {
|
||||
[profileArray addObject:[NSDictionary dictionaryWithObjects:@[@"ncpu",@"Number of CPUs", @(value), @(value)] forKeys:profileDictKeys]];
|
||||
}
|
||||
|
||||
// User preferred language
|
||||
NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
|
||||
NSArray *languages = [defs objectForKey:@"AppleLanguages"];
|
||||
if ([languages count] > 0)
|
||||
[profileArray addObject:[NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"lang",@"Preferred Language", [languages objectAtIndex:0], [languages objectAtIndex:0],nil] forKeys:profileDictKeys]];
|
||||
if ([languages count] > 0) {
|
||||
[profileArray addObject:[NSDictionary dictionaryWithObjects:@[@"lang",@"Preferred Language", languages[0], languages[0]] forKeys:profileDictKeys]];
|
||||
}
|
||||
|
||||
// Application sending the request
|
||||
NSString *appName = [host name];
|
||||
if (appName)
|
||||
[profileArray addObject:[NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"appName",@"Application Name", appName, appName,nil] forKeys:profileDictKeys]];
|
||||
if (appName) {
|
||||
[profileArray addObject:[NSDictionary dictionaryWithObjects:@[@"appName",@"Application Name", appName, appName] forKeys:profileDictKeys]];
|
||||
}
|
||||
NSString *appVersion = [host version];
|
||||
if (appVersion)
|
||||
[profileArray addObject:[NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"appVersion",@"Application Version", appVersion, appVersion,nil] forKeys:profileDictKeys]];
|
||||
if (appVersion) {
|
||||
[profileArray addObject:[NSDictionary dictionaryWithObjects:@[@"appVersion",@"Application Version", appVersion, appVersion] forKeys:profileDictKeys]];
|
||||
}
|
||||
|
||||
// Number of displays?
|
||||
|
||||
// CPU speed
|
||||
SInt32 gestaltInfo;
|
||||
OSErr err = Gestalt(gestaltProcClkSpeedMHz,&gestaltInfo);
|
||||
if (err == noErr)
|
||||
[profileArray addObject:[NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"cpuFreqMHz",@"CPU Speed (GHz)", [NSNumber numberWithInt:gestaltInfo], [NSNumber numberWithDouble:gestaltInfo/1000.0],nil] forKeys:profileDictKeys]];
|
||||
unsigned long hz;
|
||||
size_t hz_size = sizeof(unsigned long);
|
||||
if (sysctlbyname("hw.cpufrequency", &hz, &hz_size, NULL, 0) == 0) {
|
||||
unsigned long mhz = hz / 1000000;
|
||||
[profileArray addObject:[NSDictionary dictionaryWithObjects:@[@"cpuFreqMHz",@"CPU Speed (GHz)", @(mhz), @(mhz / 1000.)] forKeys:profileDictKeys]];
|
||||
}
|
||||
|
||||
// amount of RAM
|
||||
err = Gestalt(gestaltPhysicalRAMSizeInMegabytes,&gestaltInfo);
|
||||
if (err == noErr)
|
||||
[profileArray addObject:[NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"ramMB",@"Memory (MB)", [NSNumber numberWithInt:gestaltInfo], [NSNumber numberWithInt:gestaltInfo],nil] forKeys:profileDictKeys]];
|
||||
unsigned long bytes;
|
||||
size_t bytes_size = sizeof(unsigned long);
|
||||
if (sysctlbyname("hw.memsize", &bytes, &bytes_size, NULL, 0) == 0) {
|
||||
double megabytes = bytes / (1024.*1024.);
|
||||
[profileArray addObject:[NSDictionary dictionaryWithObjects:@[@"ramMB",@"Memory (MB)", @(megabytes), @(megabytes)] forKeys:profileDictKeys]];
|
||||
}
|
||||
|
||||
return profileArray;
|
||||
}
|
||||
|
||||
@@ -11,10 +11,11 @@
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "SUBasicUpdateDriver.h"
|
||||
#import "SUUpdateAlert.h"
|
||||
|
||||
@class SUStatusController, SUUpdateAlert;
|
||||
@class SUStatusController;
|
||||
|
||||
@interface SUUIBasedUpdateDriver : SUBasicUpdateDriver
|
||||
@interface SUUIBasedUpdateDriver : SUBasicUpdateDriver <SUUnarchiverDelegate, SUUpdateAlertDelegate>
|
||||
{
|
||||
SUStatusController *statusController;
|
||||
SUUpdateAlert *updateAlert;
|
||||
|
||||
+15
-26
@@ -13,7 +13,6 @@
|
||||
#import "SUHost.h"
|
||||
#import "SUStatusController.h"
|
||||
#import "SUConstants.h"
|
||||
#import "SUPasswordPrompt.h"
|
||||
|
||||
@implementation SUUIBasedUpdateDriver
|
||||
|
||||
@@ -23,12 +22,14 @@
|
||||
[updateAlert setDelegate:self];
|
||||
|
||||
id<SUVersionDisplay> versDisp = nil;
|
||||
if ([[updater delegate] respondsToSelector:@selector(versionDisplayerForUpdater:)])
|
||||
if ([[updater delegate] respondsToSelector:@selector(versionDisplayerForUpdater:)]) {
|
||||
versDisp = [[updater delegate] versionDisplayerForUpdater: updater];
|
||||
}
|
||||
[updateAlert setVersionDisplayer: versDisp];
|
||||
|
||||
if ([[updater delegate] respondsToSelector:@selector(updater:didFindValidUpdate:)])
|
||||
if ([[updater delegate] respondsToSelector:@selector(updater:didFindValidUpdate:)]) {
|
||||
[[updater delegate] updater:updater didFindValidUpdate:updateItem];
|
||||
}
|
||||
|
||||
// If the app is a menubar app or the like, we need to focus it first and alter the
|
||||
// update prompt to behave like a normal window. Otherwise if the window were hidden
|
||||
@@ -50,6 +51,7 @@
|
||||
{
|
||||
if ([[updater delegate] respondsToSelector:@selector(updaterDidNotFindUpdate:)])
|
||||
[[updater delegate] updaterDidNotFindUpdate:updater];
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:SUUpdaterDidNotFindUpdateNotification object:updater];
|
||||
|
||||
NSAlert *alert = [NSAlert alertWithMessageText:SULocalizedString(@"You're up-to-date!", nil) defaultButton:SULocalizedString(@"OK", nil) alternateButton:nil otherButton:nil informativeTextWithFormat:SULocalizedString(@"%@ %@ is currently the newest version available.", nil), [host name], [host displayVersion]];
|
||||
[self showModalAlert:alert];
|
||||
@@ -99,14 +101,17 @@
|
||||
|
||||
- (NSString *)humanReadableSizeFromDouble:(double)value
|
||||
{
|
||||
if (value < 1000)
|
||||
if (value < 1000) {
|
||||
return [NSString stringWithFormat:@"%.0lf %@", value, SULocalizedString(@"B", @"the unit for bytes")];
|
||||
}
|
||||
|
||||
if (value < 1000 * 1000)
|
||||
if (value < 1000 * 1000) {
|
||||
return [NSString stringWithFormat:@"%.0lf %@", value / 1000.0, SULocalizedString(@"KB", @"the unit for kilobytes")];
|
||||
}
|
||||
|
||||
if (value < 1000 * 1000 * 1000)
|
||||
if (value < 1000 * 1000 * 1000) {
|
||||
return [NSString stringWithFormat:@"%.1lf %@", value / 1000.0 / 1000.0, SULocalizedString(@"MB", @"the unit for megabytes")];
|
||||
}
|
||||
|
||||
return [NSString stringWithFormat:@"%.2lf %@", value / 1000.0 / 1000.0 / 1000.0, SULocalizedString(@"GB", @"the unit for gigabytes")];
|
||||
}
|
||||
@@ -141,12 +146,8 @@
|
||||
if ([statusController maxProgressValue] == 0.0)
|
||||
{
|
||||
NSDictionary * attributes;
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4
|
||||
attributes = [[NSFileManager defaultManager] fileAttributesAtPath:downloadPath traverseLink:NO];
|
||||
#else
|
||||
attributes = [[NSFileManager defaultManager] attributesOfItemAtPath:downloadPath error:nil];
|
||||
#endif
|
||||
[statusController setMaxProgressValue:[[attributes objectForKey:NSFileSize] doubleValue]];
|
||||
[statusController setMaxProgressValue:[attributes[NSFileSize] doubleValue]];
|
||||
}
|
||||
[statusController setProgressValue:[statusController progressValue] + (double)length];
|
||||
}
|
||||
@@ -161,19 +162,6 @@
|
||||
[NSApp requestUserAttention:NSInformationalRequest];
|
||||
}
|
||||
|
||||
- (void)unarchiver:(SUUnarchiver *)unarchiver requiresPasswordReturnedViaInvocation:(NSInvocation *)invocation
|
||||
{
|
||||
SUPasswordPrompt *prompt = [[SUPasswordPrompt alloc] initWithHost:host];
|
||||
NSString *password = nil;
|
||||
if([prompt run])
|
||||
{
|
||||
password = [prompt password];
|
||||
}
|
||||
[prompt release];
|
||||
[invocation setArgument:&password atIndex:2];
|
||||
[invocation invoke];
|
||||
}
|
||||
|
||||
- (void)installAndRestart: (id)sender
|
||||
{
|
||||
[self installWithToolAndRelaunch:YES];
|
||||
@@ -201,7 +189,7 @@
|
||||
|
||||
- (void)abortUpdateWithError:(NSError *)error
|
||||
{
|
||||
NSAlert *alert = [NSAlert alertWithMessageText:SULocalizedString(@"Update Error!", nil) defaultButton:SULocalizedString(@"Cancel Update", nil) alternateButton:nil otherButton:nil informativeTextWithFormat:[error localizedDescription]];
|
||||
NSAlert *alert = [NSAlert alertWithMessageText:SULocalizedString(@"Update Error!", nil) defaultButton:SULocalizedString(@"Cancel Update", nil) alternateButton:nil otherButton:nil informativeTextWithFormat: @"%@", [error localizedDescription]];
|
||||
[self showModalAlert:alert];
|
||||
[super abortUpdateWithError:error];
|
||||
}
|
||||
@@ -219,8 +207,9 @@
|
||||
|
||||
- (void)showModalAlert:(NSAlert *)alert
|
||||
{
|
||||
if ([[updater delegate] respondsToSelector:@selector(updaterWillShowModalAlert:)])
|
||||
if ([[updater delegate] respondsToSelector:@selector(updaterWillShowModalAlert:)]) {
|
||||
[[updater delegate] updaterWillShowModalAlert: updater];
|
||||
}
|
||||
|
||||
// When showing a modal alert we need to ensure that background applications
|
||||
// are focused to inform the user since there is no dock icon to notify them.
|
||||
|
||||
+6
-6
@@ -10,25 +10,25 @@
|
||||
#define SUUNARCHIVER_H
|
||||
|
||||
@class SUHost;
|
||||
@protocol SUUnarchiverDelegate;
|
||||
|
||||
@interface SUUnarchiver : NSObject {
|
||||
id delegate;
|
||||
id<SUUnarchiverDelegate> delegate;
|
||||
NSString *archivePath;
|
||||
SUHost *updateHost;
|
||||
}
|
||||
@property (assign) id<SUUnarchiverDelegate> delegate;
|
||||
|
||||
+ (SUUnarchiver *)unarchiverForPath:(NSString *)path updatingHost:(SUHost *)host;
|
||||
- (void)setDelegate:delegate;
|
||||
|
||||
- (void)start;
|
||||
|
||||
@end
|
||||
|
||||
@interface NSObject (SUUnarchiverDelegate)
|
||||
- (void)unarchiver:(SUUnarchiver *)unarchiver extractedLength:(unsigned long)length;
|
||||
@protocol SUUnarchiverDelegate <NSObject>
|
||||
- (void)unarchiverDidFinish:(SUUnarchiver *)unarchiver;
|
||||
- (void)unarchiverDidFail:(SUUnarchiver *)unarchiver;
|
||||
- (void)unarchiver:(SUUnarchiver *)unarchiver requiresPasswordReturnedViaInvocation:(NSInvocation *)invocation;
|
||||
@optional
|
||||
- (void)unarchiver:(SUUnarchiver *)unarchiver extractedLength:(unsigned long)length;
|
||||
@end
|
||||
|
||||
#endif
|
||||
+4
-9
@@ -16,26 +16,21 @@
|
||||
#import "SUUnarchiver_Private.h"
|
||||
|
||||
@implementation SUUnarchiver
|
||||
@synthesize delegate;
|
||||
|
||||
+ (SUUnarchiver *)unarchiverForPath:(NSString *)path updatingHost:(SUHost *)host
|
||||
{
|
||||
NSEnumerator *implementationEnumerator = [[self unarchiverImplementations] objectEnumerator];
|
||||
id current;
|
||||
while ((current = [implementationEnumerator nextObject]))
|
||||
for (id current in [self unarchiverImplementations])
|
||||
{
|
||||
if ([current canUnarchivePath:path])
|
||||
if ([current canUnarchivePath:path]) {
|
||||
return [[[current alloc] initWithPath:path host:host] autorelease];
|
||||
}
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSString *)description { return [NSString stringWithFormat:@"%@ <%@>", [self class], archivePath]; }
|
||||
|
||||
- (void)setDelegate:del
|
||||
{
|
||||
delegate = del;
|
||||
}
|
||||
|
||||
- (void)start
|
||||
{
|
||||
// No-op
|
||||
|
||||
@@ -16,9 +16,9 @@
|
||||
+ (void)registerImplementation:(Class)implementation;
|
||||
+ (NSArray *)unarchiverImplementations;
|
||||
+ (BOOL)canUnarchivePath:(NSString *)path;
|
||||
- (id)initWithPath:(NSString *)path host:(SUHost *)host;;
|
||||
- (instancetype)initWithPath:(NSString *)path host:(SUHost *)host;
|
||||
|
||||
- (void)notifyDelegateOfExtractedLength:(NSNumber *)length;
|
||||
- (void)notifyDelegateOfExtractedLength:(size_t)length;
|
||||
- (void)notifyDelegateOfSuccess;
|
||||
- (void)notifyDelegateOfFailure;
|
||||
@end
|
||||
|
||||
+13
-9
@@ -10,7 +10,7 @@
|
||||
|
||||
@implementation SUUnarchiver (Private)
|
||||
|
||||
- (id)initWithPath:(NSString *)path host:(SUHost *)host
|
||||
- (instancetype)initWithPath:(NSString *)path host:(SUHost *)host
|
||||
{
|
||||
if ((self = [super init]))
|
||||
{
|
||||
@@ -32,30 +32,34 @@
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void)notifyDelegateOfExtractedLength:(NSNumber *)length
|
||||
- (void)notifyDelegateOfExtractedLength:(size_t)length
|
||||
{
|
||||
if ([delegate respondsToSelector:@selector(unarchiver:extractedLength:)])
|
||||
[delegate unarchiver:self extractedLength:[length unsignedLongValue]];
|
||||
if ([delegate respondsToSelector:@selector(unarchiver:extractedLength:)]) {
|
||||
[delegate unarchiver:self extractedLength:length];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)notifyDelegateOfSuccess
|
||||
{
|
||||
if ([delegate respondsToSelector:@selector(unarchiverDidFinish:)])
|
||||
[delegate performSelector:@selector(unarchiverDidFinish:) withObject:self];
|
||||
if ([delegate respondsToSelector:@selector(unarchiverDidFinish:)]) {
|
||||
[delegate unarchiverDidFinish:self];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)notifyDelegateOfFailure
|
||||
{
|
||||
if ([delegate respondsToSelector:@selector(unarchiverDidFail:)])
|
||||
[delegate performSelector:@selector(unarchiverDidFail:) withObject:self];
|
||||
if ([delegate respondsToSelector:@selector(unarchiverDidFail:)]) {
|
||||
[delegate unarchiverDidFail:self];
|
||||
}
|
||||
}
|
||||
|
||||
static NSMutableArray *gUnarchiverImplementations;
|
||||
|
||||
+ (void)registerImplementation:(Class)implementation
|
||||
{
|
||||
if (!gUnarchiverImplementations)
|
||||
if (!gUnarchiverImplementations) {
|
||||
gUnarchiverImplementations = [[NSMutableArray alloc] init];
|
||||
}
|
||||
[gUnarchiverImplementations addObject:implementation];
|
||||
}
|
||||
|
||||
|
||||
+6
-7
@@ -12,6 +12,7 @@
|
||||
#import "SUWindowController.h"
|
||||
#import "SUVersionDisplayProtocol.h"
|
||||
|
||||
@protocol SUUpdateAlertDelegate;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
@@ -25,8 +26,6 @@ typedef enum
|
||||
@interface SUUpdateAlert : SUWindowController {
|
||||
SUAppcastItem *updateItem;
|
||||
SUHost *host;
|
||||
id delegate;
|
||||
id<SUVersionDisplay> versionDisplayer;
|
||||
|
||||
IBOutlet WebView *releaseNotesView;
|
||||
IBOutlet NSTextField *description;
|
||||
@@ -36,20 +35,20 @@ typedef enum
|
||||
NSProgressIndicator *releaseNotesSpinner;
|
||||
BOOL webViewFinishedLoading;
|
||||
}
|
||||
@property (assign) id<SUUpdateAlertDelegate> delegate;
|
||||
@property (assign) id<SUVersionDisplay> versionDisplayer;
|
||||
|
||||
- (id)initWithAppcastItem:(SUAppcastItem *)item host:(SUHost *)host;
|
||||
- (void)setDelegate:delegate;
|
||||
- (instancetype)initWithAppcastItem:(SUAppcastItem *)item host:(SUHost *)host;
|
||||
|
||||
- (IBAction)installUpdate:sender;
|
||||
- (IBAction)skipThisVersion:sender;
|
||||
- (IBAction)remindMeLater:sender;
|
||||
|
||||
- (void)setVersionDisplayer: (id<SUVersionDisplay>)disp;
|
||||
|
||||
@end
|
||||
|
||||
@interface NSObject (SUUpdateAlertDelegate)
|
||||
@protocol SUUpdateAlertDelegate <NSObject>
|
||||
- (void)updateAlert:(SUUpdateAlert *)updateAlert finishedWithChoice:(SUUpdateAlertChoice)updateChoice;
|
||||
@optional
|
||||
- (void)updateAlert:(SUUpdateAlert *)updateAlert shouldAllowAutoUpdate: (BOOL*)shouldAllowAutoUpdate;
|
||||
@end
|
||||
|
||||
|
||||
+22
-22
@@ -18,7 +18,7 @@
|
||||
#import "SUConstants.h"
|
||||
|
||||
|
||||
@interface WebView (SUTenFiveProperty)
|
||||
@interface WebView ()
|
||||
|
||||
-(void) setDrawsBackground: (BOOL)state;
|
||||
|
||||
@@ -26,8 +26,10 @@
|
||||
|
||||
|
||||
@implementation SUUpdateAlert
|
||||
@synthesize delegate;
|
||||
@synthesize versionDisplayer;
|
||||
|
||||
- (id)initWithAppcastItem:(SUAppcastItem *)item host:(SUHost *)aHost
|
||||
- (instancetype)initWithAppcastItem:(SUAppcastItem *)item host:(SUHost *)aHost
|
||||
{
|
||||
self = [super initWithHost:host windowNibName:@"SUUpdateAlert"];
|
||||
if (self)
|
||||
@@ -53,11 +55,6 @@
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void)setVersionDisplayer: (id<SUVersionDisplay>)disp
|
||||
{
|
||||
versionDisplayer = disp;
|
||||
}
|
||||
|
||||
- (void)endWithSelection:(SUUpdateAlertChoice)choice
|
||||
{
|
||||
[releaseNotesView stopLoading:self];
|
||||
@@ -93,8 +90,14 @@
|
||||
{
|
||||
// Set the default font
|
||||
[releaseNotesView setPreferencesIdentifier:[SPARKLE_BUNDLE bundleIdentifier]];
|
||||
[[releaseNotesView preferences] setStandardFontFamily:[[NSFont systemFontOfSize:8] familyName]];
|
||||
[[releaseNotesView preferences] setDefaultFontSize:(int)[NSFont systemFontSizeForControlSize:NSSmallControlSize]];
|
||||
WebPreferences *prefs = [releaseNotesView preferences];
|
||||
NSString *familyName = [[NSFont systemFontOfSize:8] familyName];
|
||||
if ([familyName hasPrefix:@"."]) { // 10.9 returns ".Lucida Grande UI", which isn't a valid name for the WebView
|
||||
familyName = @"Lucida Grande";
|
||||
}
|
||||
[prefs setStandardFontFamily:familyName];
|
||||
[prefs setDefaultFontSize:(int)[NSFont systemFontSizeForControlSize:NSSmallControlSize]];
|
||||
[prefs setPlugInsEnabled:NO];
|
||||
[releaseNotesView setFrameLoadDelegate:self];
|
||||
[releaseNotesView setPolicyDelegate:self];
|
||||
|
||||
@@ -155,8 +158,9 @@
|
||||
{
|
||||
NSString* sizeStr = [host objectForInfoDictionaryKey:SUFixedHTMLDisplaySizeKey];
|
||||
|
||||
if( [host isBackgroundApplication] )
|
||||
if ([host isBackgroundApplication]) {
|
||||
[[self window] setLevel:NSFloatingWindowLevel]; // This means the window will float over all other apps, if our app is switched out ?! UK 2007-09-04
|
||||
}
|
||||
[[self window] setFrameAutosaveName: sizeStr ? @"" : @"SUUpdateAlertFrame"];
|
||||
|
||||
// We're gonna do some frame magic to match the window's size to the description field and the presence of the release notes view.
|
||||
@@ -167,8 +171,9 @@
|
||||
// Resize the window to be appropriate for not having a huge release notes view.
|
||||
frame.size.height -= [releaseNotesView frame].size.height + 40; // Extra 40 is for the release notes label and margin.
|
||||
|
||||
if ([self allowsAutomaticUpdates])
|
||||
if ([self allowsAutomaticUpdates]) {
|
||||
frame.size.height += 10; // Make room for the check box.
|
||||
}
|
||||
|
||||
// Hiding the resize handles is not enough on 10.5, you can still click
|
||||
// where they would be, so we set the min/max sizes to be equal to
|
||||
@@ -196,7 +201,7 @@
|
||||
#define DISTANCE_BETWEEN_BUTTON_GROUPS 12
|
||||
|
||||
CGFloat minimumWindowWidth = [[self window] frame].size.width -NSMaxX([installButton frame]) +NSMinX([skipButton frame]); // Distance between contents and left/right edge.
|
||||
NSDictionary* attrs = [NSDictionary dictionaryWithObjectsAndKeys: [installButton font], NSFontAttributeName, nil];
|
||||
NSDictionary* attrs = @{NSFontAttributeName: [installButton font]};
|
||||
NSSize titleSize = [[installButton title] sizeWithAttributes: attrs];
|
||||
titleSize.width += (16 + 8) * 2; // 16 px for the end caps plus 8 px padding at each end or it'll look as ugly as calling -sizeToFit.
|
||||
NSRect installBtnBox = [installButton frame];
|
||||
@@ -243,8 +248,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
if( frame.size.width < minimumWindowWidth )
|
||||
if (frame.size.width < minimumWindowWidth) {
|
||||
frame.size.width = minimumWindowWidth;
|
||||
}
|
||||
|
||||
[[self window] setFrame: frame display: NO];
|
||||
[[self window] center];
|
||||
@@ -290,8 +296,9 @@
|
||||
updateItemVersion = [updateItemVersion stringByAppendingFormat:@" (%@)", [updateItem versionString]];
|
||||
hostVersion = [hostVersion stringByAppendingFormat:@" (%@)", [host version]];
|
||||
}
|
||||
else
|
||||
else {
|
||||
[versionDisplayer formatVersion: &updateItemVersion andVersion: &hostVersion];
|
||||
}
|
||||
return [NSString stringWithFormat:SULocalizedString(@"%@ %@ is now available--you have %@. Would you like to download it now?", nil), [host name], updateItemVersion, hostVersion];
|
||||
}
|
||||
|
||||
@@ -323,9 +330,7 @@
|
||||
|
||||
if (webViewMenuItems)
|
||||
{
|
||||
NSEnumerator *itemEnumerator = [defaultMenuItems objectEnumerator];
|
||||
NSMenuItem *menuItem = nil;
|
||||
while ((menuItem = [itemEnumerator nextObject]))
|
||||
for (NSMenuItem *menuItem in defaultMenuItems)
|
||||
{
|
||||
NSInteger tag = [menuItem tag];
|
||||
|
||||
@@ -348,9 +353,4 @@
|
||||
return webViewMenuItems;
|
||||
}
|
||||
|
||||
- (void)setDelegate:del
|
||||
{
|
||||
delegate = del;
|
||||
}
|
||||
|
||||
@end
|
||||
+7
-6
@@ -14,21 +14,22 @@
|
||||
extern NSString * const SUUpdateDriverFinishedNotification;
|
||||
|
||||
@class SUHost, SUUpdater;
|
||||
@interface SUUpdateDriver : NSObject
|
||||
@interface SUUpdateDriver : NSObject<NSURLDownloadDelegate>
|
||||
{
|
||||
SUHost *host;
|
||||
SUUpdater *updater;
|
||||
SUUpdater *updater; //assigned
|
||||
NSURL *appcastURL;
|
||||
|
||||
BOOL finished;
|
||||
BOOL isInterruptible;
|
||||
}
|
||||
@property (retain) SUHost *host;
|
||||
|
||||
- initWithUpdater:(SUUpdater *)updater;
|
||||
- (instancetype) initWithUpdater:(SUUpdater *)updater;
|
||||
- (void)checkForUpdatesAtURL:(NSURL *)URL host:(SUHost *)host;
|
||||
- (void)abortUpdate;
|
||||
- (BOOL)finished;
|
||||
- (SUHost*)host;
|
||||
- (void)setHost:(SUHost*)newHost;
|
||||
@property (getter=isInterruptible, readonly) BOOL interruptible;
|
||||
@property (readonly) BOOL finished;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
+9
-17
@@ -12,10 +12,15 @@
|
||||
NSString * const SUUpdateDriverFinishedNotification = @"SUUpdateDriverFinished";
|
||||
|
||||
@implementation SUUpdateDriver
|
||||
- initWithUpdater:(SUUpdater *)anUpdater
|
||||
@synthesize host;
|
||||
@synthesize interruptible = isInterruptible;
|
||||
@synthesize finished;
|
||||
|
||||
- (instancetype) initWithUpdater:(SUUpdater *)anUpdater
|
||||
{
|
||||
if ((self = [super init]))
|
||||
if ((self = [super init])) {
|
||||
updater = anUpdater;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -29,28 +34,15 @@ NSString * const SUUpdateDriverFinishedNotification = @"SUUpdateDriverFinished";
|
||||
|
||||
- (void)abortUpdate
|
||||
{
|
||||
[self setValue:[NSNumber numberWithBool:YES] forKey:@"finished"];
|
||||
[self setValue:@YES forKey:@"finished"];
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:SUUpdateDriverFinishedNotification object:self];
|
||||
}
|
||||
|
||||
- (BOOL)finished { return finished; }
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[host release];
|
||||
self.host = nil;
|
||||
[appcastURL release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (SUHost*)host
|
||||
{
|
||||
return host;
|
||||
}
|
||||
|
||||
- (void)setHost:(SUHost*)newHost
|
||||
{
|
||||
[host release];
|
||||
host = [newHost retain];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -16,23 +16,24 @@ typedef enum {
|
||||
SUDoNotAutomaticallyCheck
|
||||
} SUPermissionPromptResult;
|
||||
|
||||
@protocol SUUpdatePermissionPromptDelegateProtocol;
|
||||
|
||||
@class SUHost;
|
||||
@interface SUUpdatePermissionPrompt : SUWindowController {
|
||||
SUHost *host;
|
||||
NSArray *systemProfileInformationArray;
|
||||
id delegate;
|
||||
id<SUUpdatePermissionPromptDelegateProtocol> delegate;
|
||||
IBOutlet NSTextField *descriptionTextField;
|
||||
IBOutlet NSView *moreInfoView;
|
||||
IBOutlet NSButton *moreInfoButton;
|
||||
IBOutlet NSTableView *profileTableView;
|
||||
BOOL isShowingMoreInfo, shouldSendProfile;
|
||||
}
|
||||
+ (void)promptWithHost:(SUHost *)aHost systemProfile:(NSArray *)profile delegate:(id)d;
|
||||
+ (void)promptWithHost:(SUHost *)aHost systemProfile:(NSArray *)profile delegate:(id<SUUpdatePermissionPromptDelegateProtocol>)d;
|
||||
- (IBAction)toggleMoreInfo:(id)sender;
|
||||
- (IBAction)finishPrompt:(id)sender;
|
||||
@end
|
||||
|
||||
@interface NSObject (SUUpdatePermissionPromptDelegateInformalProtocol)
|
||||
@protocol SUUpdatePermissionPromptDelegateProtocol <NSObject>
|
||||
- (void)updatePermissionPromptFinishedWithResult:(SUPermissionPromptResult)result;
|
||||
@end
|
||||
|
||||
|
||||
+13
-10
@@ -11,6 +11,10 @@
|
||||
#import "SUHost.h"
|
||||
#import "SUConstants.h"
|
||||
|
||||
@interface SUUpdatePermissionPrompt ()
|
||||
@property BOOL isShowingMoreInfo, shouldSendProfile;
|
||||
@end
|
||||
|
||||
@implementation SUUpdatePermissionPrompt
|
||||
|
||||
- (BOOL)shouldAskAboutProfile
|
||||
@@ -18,15 +22,15 @@
|
||||
return [[host objectForInfoDictionaryKey:SUEnableSystemProfilingKey] boolValue];
|
||||
}
|
||||
|
||||
- (id)initWithHost:(SUHost *)aHost systemProfile:(NSArray *)profile delegate:(id)d
|
||||
- (instancetype)initWithHost:(SUHost *)aHost systemProfile:(NSArray *)profile delegate:(id<SUUpdatePermissionPromptDelegateProtocol>)d
|
||||
{
|
||||
self = [super initWithHost:aHost windowNibName:@"SUUpdatePermissionPrompt"];
|
||||
if (self)
|
||||
{
|
||||
host = [aHost retain];
|
||||
delegate = d;
|
||||
isShowingMoreInfo = NO;
|
||||
shouldSendProfile = [self shouldAskAboutProfile];
|
||||
self.isShowingMoreInfo = NO;
|
||||
self.shouldSendProfile = [self shouldAskAboutProfile];
|
||||
systemProfileInformationArray = [profile retain];
|
||||
[self setShouldCascadeWindows:NO];
|
||||
}
|
||||
@@ -80,9 +84,7 @@
|
||||
|
||||
- (IBAction)toggleMoreInfo:(id)sender
|
||||
{
|
||||
[self willChangeValueForKey:@"isShowingMoreInfo"];
|
||||
isShowingMoreInfo = !isShowingMoreInfo;
|
||||
[self didChangeValueForKey:@"isShowingMoreInfo"];
|
||||
self.isShowingMoreInfo = !_isShowingMoreInfo;
|
||||
|
||||
NSView *contentView = [[self window] contentView];
|
||||
NSRect contentViewFrame = [contentView frame];
|
||||
@@ -92,7 +94,7 @@
|
||||
NSRect profileMoreInfoButtonFrame = [moreInfoButton frame];
|
||||
NSRect descriptionFrame = [descriptionTextField frame];
|
||||
|
||||
if (isShowingMoreInfo)
|
||||
if (_isShowingMoreInfo)
|
||||
{
|
||||
// Add the subview
|
||||
contentViewFrame.size.height += profileMoreInfoViewFrame.size.height;
|
||||
@@ -120,14 +122,15 @@
|
||||
[[self window] setFrame:windowFrame display:YES animate:YES];
|
||||
[contentView setFrame:contentViewFrame];
|
||||
[contentView setNeedsDisplay:YES];
|
||||
[moreInfoView setHidden:(!isShowingMoreInfo)];
|
||||
[moreInfoView setHidden:(!_isShowingMoreInfo)];
|
||||
}
|
||||
|
||||
- (IBAction)finishPrompt:(id)sender
|
||||
{
|
||||
if (![delegate respondsToSelector:@selector(updatePermissionPromptFinishedWithResult:)])
|
||||
if (![delegate respondsToSelector:@selector(updatePermissionPromptFinishedWithResult:)]) {
|
||||
[NSException raise:@"SUInvalidDelegate" format:@"SUUpdatePermissionPrompt's delegate (%@) doesn't respond to updatePermissionPromptFinishedWithResult:!", delegate];
|
||||
[host setBool:shouldSendProfile forUserDefaultsKey:SUSendProfileInfoKey];
|
||||
}
|
||||
[host setBool:_shouldSendProfile forUserDefaultsKey:SUSendProfileInfoKey];
|
||||
[delegate updatePermissionPromptFinishedWithResult:([sender tag] == 1 ? SUAutomaticallyCheck : SUDoNotAutomaticallyCheck)];
|
||||
[[self window] close];
|
||||
[NSApp stopModal];
|
||||
|
||||
+31
-22
@@ -17,40 +17,29 @@
|
||||
@interface SUUpdater : NSObject
|
||||
{
|
||||
@private
|
||||
NSTimer *checkTimer;
|
||||
SUUpdateDriver *driver;
|
||||
|
||||
NSString *customUserAgentString;
|
||||
SUHost *host;
|
||||
IBOutlet id delegate;
|
||||
}
|
||||
@property (assign) IBOutlet id delegate;
|
||||
|
||||
+ (SUUpdater *)sharedUpdater;
|
||||
+ (SUUpdater *)updaterForBundle:(NSBundle *)bundle;
|
||||
- (id)initForBundle:(NSBundle *)bundle;
|
||||
- (instancetype)initForBundle:(NSBundle *)bundle;
|
||||
|
||||
- (NSBundle *)hostBundle;
|
||||
@property (readonly, strong) NSBundle *hostBundle;
|
||||
|
||||
- (void)setDelegate:(id)delegate;
|
||||
- (id)delegate;
|
||||
@property BOOL automaticallyChecksForUpdates;
|
||||
|
||||
- (void)setAutomaticallyChecksForUpdates:(BOOL)automaticallyChecks;
|
||||
- (BOOL)automaticallyChecksForUpdates;
|
||||
@property NSTimeInterval updateCheckInterval;
|
||||
|
||||
- (void)setUpdateCheckInterval:(NSTimeInterval)interval;
|
||||
- (NSTimeInterval)updateCheckInterval;
|
||||
@property (copy) NSURL *feedURL; // *** MUST BE CALLED ON MAIN THREAD ***
|
||||
|
||||
- (void)setFeedURL:(NSURL *)feedURL;
|
||||
- (NSURL *)feedURL; // *** MUST BE CALLED ON MAIN THREAD ***
|
||||
@property (nonatomic, copy) NSString *userAgentString;
|
||||
|
||||
- (void)setUserAgentString:(NSString *)userAgent;
|
||||
- (NSString *)userAgentString;
|
||||
@property BOOL sendsSystemProfile;
|
||||
|
||||
- (void)setSendsSystemProfile:(BOOL)sendsSystemProfile;
|
||||
- (BOOL)sendsSystemProfile;
|
||||
|
||||
- (void)setAutomaticallyDownloadsUpdates:(BOOL)automaticallyDownloadsUpdates;
|
||||
- (BOOL)automaticallyDownloadsUpdates;
|
||||
@property BOOL automaticallyDownloadsUpdates;
|
||||
|
||||
// This IBAction is meant for a main menu item. Hook up any menu item to this action,
|
||||
// and Sparkle will check for updates and report back its findings verbosely.
|
||||
@@ -62,7 +51,7 @@
|
||||
- (void)checkForUpdatesInBackground;
|
||||
|
||||
// Date of last update check. Returns nil if no check has been performed.
|
||||
- (NSDate*)lastUpdateCheckDate;
|
||||
@property (readonly, copy) NSDate *lastUpdateCheckDate;
|
||||
|
||||
// This begins a "probing" check for updates which will not actually offer to update to that version. The delegate methods, though,
|
||||
// (up to updater:didFindValidUpdate: and updaterDidNotFindUpdate:), are called, so you can use that information in your UI.
|
||||
@@ -71,10 +60,25 @@
|
||||
// Call this to appropriately schedule or cancel the update checking timer according to the preferences for time interval and automatic checks. This call does not change the date of the next check, but only the internal NSTimer.
|
||||
- (void)resetUpdateCycle;
|
||||
|
||||
- (BOOL)updateInProgress;
|
||||
@property (readonly) BOOL updateInProgress;
|
||||
|
||||
@end
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// SUUpdater Notifications for events that might be interesting to more than just the delegate
|
||||
// The updater will be the notification object
|
||||
// -----------------------------------------------------------------------------
|
||||
extern NSString *const SUUpdaterDidFinishLoadingAppCastNotification;
|
||||
extern NSString *const SUUpdaterDidFindValidUpdateNotification;
|
||||
extern NSString *const SUUpdaterDidNotFindUpdateNotification;
|
||||
extern NSString *const SUUpdaterWillRestartNotification;
|
||||
#define SUUpdaterWillRelaunchApplicationNotification SUUpdaterWillRestartNotification;
|
||||
#define SUUpdaterWillInstallUpdateNotification SUUpdaterWillRestartNotification;
|
||||
|
||||
// Key for the SUAppcastItem object in the SUUpdaterDidFindValidUpdateNotification userInfo
|
||||
extern NSString *const SUUpdaterAppcastItemNotificationKey;
|
||||
// Key for the SUAppcast object in the SUUpdaterDidFinishLoadingAppCastNotification userInfo
|
||||
extern NSString *const SUUpdaterAppcastNotificationKey;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// SUUpdater Delegate:
|
||||
@@ -138,6 +142,11 @@
|
||||
-(void) updaterWillShowModalAlert:(SUUpdater *)updater;
|
||||
-(void) updaterDidShowModalAlert:(SUUpdater *)updater;
|
||||
|
||||
// Called when an update is scheduled to be silently installed on quit.
|
||||
// The invocation can be used to trigger an immediate silent install and relaunch.
|
||||
- (void)updater:(SUUpdater *)updater willInstallUpdateOnQuit:(SUAppcastItem *)update immediateInstallationInvocation:(NSInvocation *)invocation;
|
||||
- (void)updater:(SUUpdater *)updater didCancelInstallUpdateOnQuit:(SUAppcastItem *)update;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
||||
+101
-85
@@ -20,17 +20,23 @@
|
||||
#import "SUCodeSigningVerifier.h"
|
||||
#include <SystemConfiguration/SystemConfiguration.h>
|
||||
|
||||
NSString *const SUUpdaterDidFinishLoadingAppCastNotification = @"SUUpdaterDidFinishLoadingAppCastNotification";
|
||||
NSString *const SUUpdaterDidFindValidUpdateNotification = @"SUUpdaterDidFindValidUpdateNotification";
|
||||
NSString *const SUUpdaterDidNotFindUpdateNotification = @"SUUpdaterDidNotFindUpdateNotification";
|
||||
NSString *const SUUpdaterWillRestartNotification = @"SUUpdaterWillRestartNotificationName";
|
||||
NSString *const SUUpdaterAppcastItemNotificationKey = @"SUUpdaterAppcastItemNotificationKey";
|
||||
NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotificationKey";
|
||||
|
||||
@interface SUUpdater (Private)
|
||||
- (id)initForBundle:(NSBundle *)bundle;
|
||||
@interface SUUpdater () <SUUpdatePermissionPromptDelegateProtocol>
|
||||
@property (retain) NSTimer *checkTimer;
|
||||
- (instancetype)initForBundle:(NSBundle *)bundle;
|
||||
- (void)startUpdateCycle;
|
||||
- (void)checkForUpdatesWithDriver:(SUUpdateDriver *)updateDriver;
|
||||
- (BOOL)automaticallyDownloadsUpdates;
|
||||
- (void)scheduleNextUpdateCheck;
|
||||
- (void)registerAsObserver;
|
||||
- (void)unregisterAsObserver;
|
||||
- (void)updateDriverDidFinish:(NSNotification *)note;
|
||||
- (NSURL *)parameterizedFeedURL;
|
||||
@property (readonly, copy) NSURL *parameterizedFeedURL;
|
||||
|
||||
-(void) notifyWillShowModalAlert;
|
||||
-(void) notifyDidShowModalAlert;
|
||||
@@ -38,6 +44,9 @@
|
||||
@end
|
||||
|
||||
@implementation SUUpdater
|
||||
@synthesize delegate;
|
||||
@synthesize checkTimer;
|
||||
@synthesize userAgentString = customUserAgentString;
|
||||
|
||||
#pragma mark Initialization
|
||||
|
||||
@@ -53,23 +62,25 @@ static NSString * const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefault
|
||||
+ (SUUpdater *)updaterForBundle:(NSBundle *)bundle
|
||||
{
|
||||
if (bundle == nil) bundle = [NSBundle mainBundle];
|
||||
id updater = [sharedUpdaters objectForKey:[NSValue valueWithNonretainedObject:bundle]];
|
||||
if (updater == nil)
|
||||
id updater = sharedUpdaters[[NSValue valueWithNonretainedObject:bundle]];
|
||||
if (updater == nil) {
|
||||
updater = [[[[self class] alloc] initForBundle:bundle] autorelease];
|
||||
}
|
||||
return updater;
|
||||
}
|
||||
|
||||
// This is the designated initializer for SUUpdater, important for subclasses
|
||||
- (id)initForBundle:(NSBundle *)bundle
|
||||
- (instancetype)initForBundle:(NSBundle *)bundle
|
||||
{
|
||||
self = [super init];
|
||||
if (bundle == nil) bundle = [NSBundle mainBundle];
|
||||
|
||||
// Register as observer straight away to avoid exceptions on -dealloc when -unregisterAsObserver is called:
|
||||
if (self)
|
||||
if (self) {
|
||||
[self registerAsObserver];
|
||||
}
|
||||
|
||||
id updater = [sharedUpdaters objectForKey:[NSValue valueWithNonretainedObject:bundle]];
|
||||
id updater = sharedUpdaters[[NSValue valueWithNonretainedObject:bundle]];
|
||||
if (updater)
|
||||
{
|
||||
[self release];
|
||||
@@ -77,9 +88,10 @@ static NSString * const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefault
|
||||
}
|
||||
else if (self)
|
||||
{
|
||||
if (sharedUpdaters == nil)
|
||||
if (sharedUpdaters == nil) {
|
||||
sharedUpdaters = [[NSMutableDictionary alloc] init];
|
||||
[sharedUpdaters setObject:self forKey:[NSValue valueWithNonretainedObject:bundle]];
|
||||
}
|
||||
sharedUpdaters[[NSValue valueWithNonretainedObject:bundle]] = self;
|
||||
host = [[SUHost alloc] initWithBundle:bundle];
|
||||
|
||||
#if !ENDANGER_USERS_WITH_INSECURE_UPDATES
|
||||
@@ -105,7 +117,7 @@ static NSString * const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefault
|
||||
|
||||
|
||||
// This will be used when the updater is instantiated in a nib such as MainMenu
|
||||
- (id)init
|
||||
- (instancetype)init
|
||||
{
|
||||
return [self initForBundle:[NSBundle mainBundle]];
|
||||
}
|
||||
@@ -144,8 +156,9 @@ static NSString * const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefault
|
||||
// Has he been asked already? And don't ask if the host has a default value set in its Info.plist.
|
||||
else if ([host objectForKey:SUEnableAutomaticChecksKey] == nil)
|
||||
{
|
||||
if ([host objectForUserDefaultsKey:SUEnableAutomaticChecksKeyOld])
|
||||
if ([host objectForUserDefaultsKey:SUEnableAutomaticChecksKeyOld]) {
|
||||
[self setAutomaticallyChecksForUpdates:[host boolForUserDefaultsKey:SUEnableAutomaticChecksKeyOld]];
|
||||
}
|
||||
// Now, we don't want to ask the user for permission to do a weird thing on the first launch.
|
||||
// We wait until the second launch, unless explicitly overridden via SUPromptUserOnFirstLaunchKey.
|
||||
else if (![host objectForKey:SUPromptUserOnFirstLaunchKey])
|
||||
@@ -163,8 +176,9 @@ static NSString * const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefault
|
||||
{
|
||||
NSArray *profileInfo = [host systemProfile];
|
||||
// Always say we're sending the system profile here so that the delegate displays the parameters it would send.
|
||||
if ([delegate respondsToSelector:@selector(feedParametersForUpdater:sendingSystemProfile:)])
|
||||
if ([delegate respondsToSelector:@selector(feedParametersForUpdater:sendingSystemProfile:)]) {
|
||||
profileInfo = [profileInfo arrayByAddingObjectsFromArray:[delegate feedParametersForUpdater:self sendingSystemProfile:YES]];
|
||||
}
|
||||
[SUUpdatePermissionPrompt promptWithHost:host systemProfile:profileInfo delegate:self];
|
||||
// We start the update checks and register as observer for changes after the prompt finishes
|
||||
}
|
||||
@@ -201,8 +215,7 @@ static NSString * const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefault
|
||||
if (checkTimer)
|
||||
{
|
||||
[checkTimer invalidate];
|
||||
[checkTimer release]; // UK 2009-03-16 Timer is non-repeating, may have invalidated itself, so we had to retain it.
|
||||
checkTimer = nil;
|
||||
self.checkTimer = nil; // UK 2009-03-16 Timer is non-repeating, may have invalidated itself, so we had to retain it.
|
||||
}
|
||||
if (![self automaticallyChecksForUpdates]) return;
|
||||
|
||||
@@ -219,61 +232,65 @@ static NSString * const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefault
|
||||
delayUntilCheck = (updateCheckInterval - intervalSinceCheck); // It hasn't been long enough.
|
||||
else
|
||||
delayUntilCheck = 0; // We're overdue! Run one now.
|
||||
checkTimer = [[NSTimer scheduledTimerWithTimeInterval:delayUntilCheck target:self selector:@selector(checkForUpdatesInBackground) userInfo:nil repeats:NO] retain]; // UK 2009-03-16 Timer is non-repeating, may have invalidated itself, so we had to retain it.
|
||||
self.checkTimer = [NSTimer scheduledTimerWithTimeInterval:delayUntilCheck target:self selector:@selector(checkForUpdatesInBackground) userInfo:nil repeats:NO]; // UK 2009-03-16 Timer is non-repeating, may have invalidated itself, so we had to retain it.
|
||||
}
|
||||
|
||||
|
||||
-(void) putFeedURLIntoDictionary: (NSMutableDictionary*)theDict // You release this.
|
||||
{
|
||||
[theDict setObject: [self feedURL] forKey: @"feedURL"];
|
||||
theDict[@"feedURL"] = [self feedURL];
|
||||
}
|
||||
|
||||
-(void) checkForUpdatesInBgReachabilityCheckWithDriver: (SUUpdateDriver*)inDriver /* RUNS ON ITS OWN THREAD */
|
||||
{
|
||||
NS_DURING
|
||||
@try {
|
||||
// This method *must* be called on its own thread. SCNetworkReachabilityCheckByName
|
||||
// can block, and it can be waiting a long time on slow networks, and we
|
||||
// wouldn't want to beachball the main thread for a background operation.
|
||||
// We could use asynchronous reachability callbacks, but those aren't
|
||||
// reliable enough and can 'get lost' sometimes, which we don't want.
|
||||
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
SCNetworkConnectionFlags flags = 0;
|
||||
BOOL isNetworkReachable = YES;
|
||||
|
||||
// Don't perform automatic checks on unconnected laptops or dial-up connections that aren't online:
|
||||
NSMutableDictionary* theDict = [NSMutableDictionary dictionary];
|
||||
[self performSelectorOnMainThread: @selector(putFeedURLIntoDictionary:) withObject: theDict waitUntilDone: YES]; // Get feed URL on main thread, it's not safe to call elsewhere.
|
||||
|
||||
const char *hostname = [[[theDict objectForKey: @"feedURL"] host] cStringUsingEncoding: NSUTF8StringEncoding];
|
||||
SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithName(NULL, hostname);
|
||||
Boolean reachabilityResult = NO;
|
||||
// If the feed's using a file:// URL, we won't be able to use reachability.
|
||||
if (reachability != NULL) {
|
||||
SCNetworkReachabilityGetFlags(reachability, &flags);
|
||||
CFRelease(reachability);
|
||||
}
|
||||
|
||||
if( reachabilityResult )
|
||||
{
|
||||
BOOL reachable = (flags & kSCNetworkFlagsReachable) == kSCNetworkFlagsReachable;
|
||||
BOOL automatic = (flags & kSCNetworkFlagsConnectionAutomatic) == kSCNetworkFlagsConnectionAutomatic;
|
||||
BOOL local = (flags & kSCNetworkFlagsIsLocalAddress) == kSCNetworkFlagsIsLocalAddress;
|
||||
@autoreleasepool {
|
||||
SCNetworkConnectionFlags flags = 0;
|
||||
BOOL isNetworkReachable = YES;
|
||||
|
||||
//NSLog(@"reachable = %s, automatic = %s, local = %s", (reachable?"YES":"NO"), (automatic?"YES":"NO"), (local?"YES":"NO"));
|
||||
// Don't perform automatic checks on unconnected laptops or dial-up connections that aren't online:
|
||||
NSMutableDictionary* theDict = [NSMutableDictionary dictionary];
|
||||
dispatch_sync(dispatch_get_main_queue(), ^{
|
||||
[self putFeedURLIntoDictionary:theDict]; // Get feed URL on main thread, it's not safe to call elsewhere.
|
||||
});
|
||||
|
||||
const char *hostname = [[theDict[@"feedURL"] host] cStringUsingEncoding: NSUTF8StringEncoding];
|
||||
SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithName(NULL, hostname);
|
||||
Boolean reachabilityResult = NO;
|
||||
// If the feed's using a file:// URL, we won't be able to use reachability.
|
||||
if (reachability != NULL) {
|
||||
SCNetworkReachabilityGetFlags(reachability, &flags);
|
||||
CFRelease(reachability);
|
||||
}
|
||||
|
||||
if( reachabilityResult )
|
||||
{
|
||||
BOOL reachable = (flags & kSCNetworkFlagsReachable) == kSCNetworkFlagsReachable;
|
||||
BOOL automatic = (flags & kSCNetworkFlagsConnectionAutomatic) == kSCNetworkFlagsConnectionAutomatic;
|
||||
BOOL local = (flags & kSCNetworkFlagsIsLocalAddress) == kSCNetworkFlagsIsLocalAddress;
|
||||
|
||||
//NSLog(@"reachable = %s, automatic = %s, local = %s", (reachable?"YES":"NO"), (automatic?"YES":"NO"), (local?"YES":"NO"));
|
||||
|
||||
if( !(reachable || automatic || local) )
|
||||
isNetworkReachable = NO;
|
||||
}
|
||||
|
||||
// If the network's not reachable, we pass a nil driver into checkForUpdatesWithDriver, which will then reschedule the next update so we try again later.
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self checkForUpdatesWithDriver: isNetworkReachable ? inDriver : nil];
|
||||
});
|
||||
|
||||
if( !(reachable || automatic || local) )
|
||||
isNetworkReachable = NO;
|
||||
}
|
||||
|
||||
// If the network's not reachable, we pass a nil driver into checkForUpdatesWithDriver, which will then reschedule the next update so we try again later.
|
||||
[self performSelectorOnMainThread: @selector(checkForUpdatesWithDriver:) withObject: isNetworkReachable ? inDriver : nil waitUntilDone: NO];
|
||||
|
||||
[pool release];
|
||||
NS_HANDLER
|
||||
} @catch (NSException *localException) {
|
||||
SULog(@"UNCAUGHT EXCEPTION IN UPDATE CHECK TIMER: %@",[localException reason]);
|
||||
// Don't propagate the exception beyond here. In Carbon apps that would trash the stack.
|
||||
NS_ENDHANDLER
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -284,7 +301,9 @@ static NSString * const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefault
|
||||
// hour or so:
|
||||
SUUpdateDriver * theUpdateDriver = [[[([self automaticallyDownloadsUpdates] ? [SUAutomaticUpdateDriver class] : [SUScheduledUpdateDriver class]) alloc] initWithUpdater:self] autorelease];
|
||||
|
||||
[NSThread detachNewThreadSelector: @selector(checkForUpdatesInBgReachabilityCheckWithDriver:) toTarget: self withObject: theUpdateDriver];
|
||||
dispatch_async(dispatch_get_global_queue(0, 0), ^{
|
||||
[self checkForUpdatesInBgReachabilityCheckWithDriver:theUpdateDriver];
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -295,6 +314,10 @@ static NSString * const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefault
|
||||
|
||||
- (IBAction)checkForUpdates: (id)sender
|
||||
{
|
||||
if (driver && [driver isInterruptible]) {
|
||||
[driver abortUpdate];
|
||||
}
|
||||
|
||||
[self checkForUpdatesWithDriver:[[[SUUserInitiatedUpdateDriver alloc] initWithUpdater:self] autorelease]];
|
||||
}
|
||||
|
||||
@@ -306,7 +329,7 @@ static NSString * const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefault
|
||||
- (void)checkForUpdatesWithDriver:(SUUpdateDriver *)d
|
||||
{
|
||||
if ([self updateInProgress]) { return; }
|
||||
if (checkTimer) { [checkTimer invalidate]; [checkTimer release]; checkTimer = nil; } // UK 2009-03-16 Timer is non-repeating, may have invalidated itself, so we had to retain it.
|
||||
if (checkTimer) { [checkTimer invalidate]; self.checkTimer = nil; } // UK 2009-03-16 Timer is non-repeating, may have invalidated itself, so we had to retain it.
|
||||
|
||||
SUClearLog();
|
||||
SULog( @"===== %@ =====", [[NSFileManager defaultManager] displayNameAtPath: [[NSBundle mainBundle] bundlePath]] );
|
||||
@@ -384,8 +407,9 @@ static NSString * const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefault
|
||||
[host setBool:automaticallyCheckForUpdates forUserDefaultsKey:SUEnableAutomaticChecksKey];
|
||||
// Hack to support backwards compatibility with older Sparkle versions, which supported
|
||||
// disabling updates by setting the check interval to 0.
|
||||
if (automaticallyCheckForUpdates && [self updateCheckInterval] == 0)
|
||||
if (automaticallyCheckForUpdates && [self updateCheckInterval] == 0) {
|
||||
[self setUpdateCheckInterval:SU_DEFAULT_CHECK_INTERVAL];
|
||||
}
|
||||
[[self class] cancelPreviousPerformRequestsWithTarget:self selector:@selector(resetUpdateCycle) object:nil];
|
||||
// Provide a small delay in case multiple preferences are being updated simultaneously.
|
||||
[self performSelector:@selector(resetUpdateCycle) withObject:nil afterDelay:1];
|
||||
@@ -394,8 +418,9 @@ static NSString * const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefault
|
||||
- (BOOL)automaticallyChecksForUpdates
|
||||
{
|
||||
// Don't automatically update when the check interval is 0, to be compatible with 1.1 settings.
|
||||
if ([self updateCheckInterval] == 0)
|
||||
if ([self updateCheckInterval] == 0) {
|
||||
return NO;
|
||||
}
|
||||
return [host boolForKey:SUEnableAutomaticChecksKey];
|
||||
}
|
||||
|
||||
@@ -407,8 +432,9 @@ static NSString * const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefault
|
||||
- (BOOL)automaticallyDownloadsUpdates
|
||||
{
|
||||
// If the SUAllowsAutomaticUpdatesKey exists and is set to NO, return NO.
|
||||
if ([host objectForInfoDictionaryKey:SUAllowsAutomaticUpdatesKey] && [host boolForInfoDictionaryKey:SUAllowsAutomaticUpdatesKey] == NO)
|
||||
if ([host objectForInfoDictionaryKey:SUAllowsAutomaticUpdatesKey] && [host boolForInfoDictionaryKey:SUAllowsAutomaticUpdatesKey] == NO) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
// Otherwise, automatically downloading updates is allowed. Does the user want it?
|
||||
return [host boolForUserDefaultsKey:SUAutomaticallyUpdateKey];
|
||||
@@ -435,19 +461,11 @@ static NSString * const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefault
|
||||
return [NSURL URLWithString: castUrlStr];
|
||||
}
|
||||
|
||||
- (void)setUserAgentString:(NSString *)userAgent
|
||||
{
|
||||
if (customUserAgentString == userAgent)
|
||||
return;
|
||||
|
||||
[customUserAgentString release];
|
||||
customUserAgentString = [userAgent copy];
|
||||
}
|
||||
|
||||
- (NSString *)userAgentString
|
||||
{
|
||||
if (customUserAgentString)
|
||||
if (customUserAgentString) {
|
||||
return customUserAgentString;
|
||||
}
|
||||
|
||||
NSString *version = [SPARKLE_BUNDLE objectForInfoDictionaryKey:@"CFBundleVersion"];
|
||||
NSString *userAgent = [NSString stringWithFormat:@"%@/%@ Sparkle/%@", [host name], [host displayVersion], version ? version : @"?"];
|
||||
@@ -462,7 +480,7 @@ static NSString * const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefault
|
||||
|
||||
- (BOOL)sendsSystemProfile
|
||||
{
|
||||
return [host boolForUserDefaultsKey:SUSendProfileInfoKey];
|
||||
return [host boolForKey:SUSendProfileInfoKey];
|
||||
}
|
||||
|
||||
- (NSURL *)parameterizedFeedURL
|
||||
@@ -474,14 +492,16 @@ static NSString * const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefault
|
||||
|
||||
// Let's only send the system profiling information once per week at most, so we normalize daily-checkers vs. biweekly-checkers and the such.
|
||||
NSDate *lastSubmitDate = [host objectForUserDefaultsKey:SULastProfileSubmitDateKey];
|
||||
if(!lastSubmitDate)
|
||||
if (!lastSubmitDate) {
|
||||
lastSubmitDate = [NSDate distantPast];
|
||||
}
|
||||
const NSTimeInterval oneWeek = 60 * 60 * 24 * 7;
|
||||
sendingSystemProfile &= (-[lastSubmitDate timeIntervalSinceNow] >= oneWeek);
|
||||
|
||||
NSArray *parameters = [NSArray array];
|
||||
if ([delegate respondsToSelector:@selector(feedParametersForUpdater:sendingSystemProfile:)])
|
||||
NSArray *parameters = @[];
|
||||
if ([delegate respondsToSelector:@selector(feedParametersForUpdater:sendingSystemProfile:)]) {
|
||||
parameters = [parameters arrayByAddingObjectsFromArray:[delegate feedParametersForUpdater:self sendingSystemProfile:sendingSystemProfile]];
|
||||
}
|
||||
if (sendingSystemProfile)
|
||||
{
|
||||
parameters = [parameters arrayByAddingObjectsFromArray:[host systemProfile]];
|
||||
@@ -491,14 +511,14 @@ static NSString * const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefault
|
||||
|
||||
// Build up the parameterized URL.
|
||||
NSMutableArray *parameterStrings = [NSMutableArray array];
|
||||
NSEnumerator *profileInfoEnumerator = [parameters objectEnumerator];
|
||||
NSDictionary *currentProfileInfo;
|
||||
while ((currentProfileInfo = [profileInfoEnumerator nextObject]))
|
||||
[parameterStrings addObject:[NSString stringWithFormat:@"%@=%@", [[[currentProfileInfo objectForKey:@"key"] description] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding], [[[currentProfileInfo objectForKey:@"value"] description] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]];
|
||||
for (NSDictionary *currentProfileInfo in parameters) {
|
||||
[parameterStrings addObject:[NSString stringWithFormat:@"%@=%@", [[currentProfileInfo[@"key"] description] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding], [[currentProfileInfo[@"value"] description] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]];
|
||||
}
|
||||
|
||||
NSString *separatorCharacter = @"?";
|
||||
if ([baseFeedURL query])
|
||||
if ([baseFeedURL query]) {
|
||||
separatorCharacter = @"&"; // In case the URL is already http://foo.org/baz.xml?bat=4
|
||||
}
|
||||
NSString *appcastStringWithProfile = [NSString stringWithFormat:@"%@%@%@", [baseFeedURL absoluteString], separatorCharacter, [parameterStrings componentsJoinedByString:@"&"]];
|
||||
|
||||
// Clean it up so it's a valid URL
|
||||
@@ -507,9 +527,10 @@ static NSString * const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefault
|
||||
|
||||
- (void)setUpdateCheckInterval:(NSTimeInterval)updateCheckInterval
|
||||
{
|
||||
[host setObject:[NSNumber numberWithDouble:updateCheckInterval] forUserDefaultsKey:SUScheduledCheckIntervalKey];
|
||||
if (updateCheckInterval == 0) // For compatibility with 1.1's settings.
|
||||
[host setObject:@(updateCheckInterval) forUserDefaultsKey:SUScheduledCheckIntervalKey];
|
||||
if (updateCheckInterval == 0) { // For compatibility with 1.1's settings.
|
||||
[self setAutomaticallyChecksForUpdates:NO];
|
||||
}
|
||||
[[self class] cancelPreviousPerformRequestsWithTarget:self selector:@selector(resetUpdateCycle) object:nil];
|
||||
|
||||
// Provide a small delay in case multiple preferences are being updated simultaneously.
|
||||
@@ -530,28 +551,23 @@ static NSString * const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefault
|
||||
{
|
||||
[self unregisterAsObserver];
|
||||
[host release];
|
||||
if (checkTimer) { [checkTimer invalidate]; [checkTimer release]; checkTimer = nil; } // UK 2009-03-16 Timer is non-repeating, may have invalidated itself, so we had to retain it.
|
||||
if (checkTimer) { [checkTimer invalidate]; self.checkTimer = nil; } // UK 2009-03-16 Timer is non-repeating, may have invalidated itself, so we had to retain it.
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (BOOL)validateMenuItem:(NSMenuItem *)item
|
||||
{
|
||||
if ([item action] == @selector(checkForUpdates:))
|
||||
if ([item action] == @selector(checkForUpdates:)) {
|
||||
return ![self updateInProgress];
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)setDelegate:aDelegate
|
||||
{
|
||||
delegate = aDelegate;
|
||||
}
|
||||
|
||||
- (BOOL)updateInProgress
|
||||
{
|
||||
return driver && ([driver finished] == NO);
|
||||
}
|
||||
|
||||
- (id)delegate { return delegate; }
|
||||
- (NSBundle *)hostBundle { return [host bundle]; }
|
||||
|
||||
@end
|
||||
+1
-1
@@ -10,6 +10,6 @@
|
||||
|
||||
@interface SUUpdater (Private)
|
||||
|
||||
- (BOOL)mayUpdateAndRestart;
|
||||
@property (readonly) BOOL mayUpdateAndRestart;
|
||||
|
||||
@end
|
||||
@@ -12,9 +12,9 @@
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@class SUHost;
|
||||
@interface SUWindowController : NSWindowController { }
|
||||
@interface SUWindowController : NSWindowController
|
||||
// We use this instead of plain old NSWindowController initWithWindowNibName so that we'll be able to find the right path when running in a bundle loaded from another app.
|
||||
- (id)initWithHost:(SUHost *)host windowNibName:(NSString *)nibName;
|
||||
- (instancetype)initWithHost:(SUHost *)host windowNibName:(NSString *)nibName;
|
||||
@end
|
||||
|
||||
#endif
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
@implementation SUWindowController
|
||||
|
||||
- (id)initWithHost:(SUHost *)host windowNibName:(NSString *)nibName
|
||||
- (instancetype)initWithHost:(SUHost *)host windowNibName:(NSString *)nibName
|
||||
{
|
||||
NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:nibName ofType:@"nib"];
|
||||
if (path == nil) // Slight hack to resolve issues with running Sparkle in debug configurations.
|
||||
|
||||
@@ -17,5 +17,6 @@
|
||||
#import <Sparkle/SUAppcast.h>
|
||||
#import <Sparkle/SUAppcastItem.h>
|
||||
#import <Sparkle/SUVersionComparisonProtocol.h>
|
||||
#import <Sparkle/SUStandardVersionComparator.h>
|
||||
|
||||
#endif
|
||||
Binary file not shown.
-12
@@ -6,18 +6,6 @@
|
||||
// Copyright 2008 Andy Matuschak. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef NSAppKitVersionNumber10_4
|
||||
#define NSAppKitVersionNumber10_4 824
|
||||
#endif
|
||||
|
||||
#ifndef NSAppKitVersionNumber10_5
|
||||
#define NSAppKitVersionNumber10_5 949
|
||||
#endif
|
||||
|
||||
#ifndef NSAppKitVersionNumber10_6
|
||||
#define NSAppKitVersionNumber10_6 1038
|
||||
#endif
|
||||
|
||||
#ifdef __OBJC__
|
||||
|
||||
#define SPARKLE_BUNDLE [NSBundle bundleWithIdentifier:@"org.andymatuschak.Sparkle"]
|
||||
|
||||
BIN
Binary file not shown.
|
After Width: | Height: | Size: 5.3 KiB |
+255
-332
File diff suppressed because it is too large.
Load diff
@@ -1,116 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0450"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "8DC2EF4F0486A6940098B216"
|
||||
BuildableName = "Sparkle.framework"
|
||||
BlueprintName = "Sparkle"
|
||||
ReferencedContainer = "container:Sparkle.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "NO"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "61B5F90109C4CEE200B25A18"
|
||||
BuildableName = "Sparkle Test App.app"
|
||||
BlueprintName = "Sparkle Test App"
|
||||
ReferencedContainer = "container:Sparkle.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "5D06E8CF0FD68C7C005AE3F6"
|
||||
BuildableName = "BinaryDelta"
|
||||
BlueprintName = "BinaryDelta"
|
||||
ReferencedContainer = "container:Sparkle.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.GDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
buildConfiguration = "Debug">
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "612279D80DB5470200AB99EA"
|
||||
BuildableName = "Sparkle Unit Tests.octest"
|
||||
BlueprintName = "Sparkle Unit Tests"
|
||||
ReferencedContainer = "container:Sparkle.xcodeproj">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "61B5F90109C4CEE200B25A18"
|
||||
BuildableName = "Sparkle Test App.app"
|
||||
BlueprintName = "Sparkle Test App"
|
||||
ReferencedContainer = "container:Sparkle.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.GDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
buildConfiguration = "Debug"
|
||||
ignoresPersistentStateOnLaunch = "YES"
|
||||
debugDocumentVersioning = "YES"
|
||||
allowLocationSimulation = "YES">
|
||||
<BuildableProductRunnable>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "61B5F90109C4CEE200B25A18"
|
||||
BuildableName = "Sparkle Test App.app"
|
||||
BlueprintName = "Sparkle Test App"
|
||||
ReferencedContainer = "container:Sparkle.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
buildConfiguration = "Release"
|
||||
ignoresPersistentStateOnLaunch = "YES"
|
||||
debugDocumentVersioning = "YES">
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
Binary file not shown.
@@ -1,43 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IBClasses</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>CLASS</key>
|
||||
<string>FirstResponder</string>
|
||||
<key>LANGUAGE</key>
|
||||
<string>ObjC</string>
|
||||
<key>SUPERCLASS</key>
|
||||
<string>NSObject</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CLASS</key>
|
||||
<string>NSObject</string>
|
||||
<key>LANGUAGE</key>
|
||||
<string>ObjC</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>ACTIONS</key>
|
||||
<dict>
|
||||
<key>checkForUpdates</key>
|
||||
<string>id</string>
|
||||
</dict>
|
||||
<key>CLASS</key>
|
||||
<string>SUUpdater</string>
|
||||
<key>LANGUAGE</key>
|
||||
<string>ObjC</string>
|
||||
<key>OUTLETS</key>
|
||||
<dict>
|
||||
<key>delegate</key>
|
||||
<string>id</string>
|
||||
</dict>
|
||||
<key>SUPERCLASS</key>
|
||||
<string>NSObject</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>IBVersion</key>
|
||||
<string>1</string>
|
||||
</dict>
|
||||
</plist>
|
||||
-2636
File diff suppressed because it is too large.
Load diff
@@ -1,21 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IBFramework Version</key>
|
||||
<string>667</string>
|
||||
<key>IBLastKnownRelativeProjectPath</key>
|
||||
<string>../../Sparkle.xcodeproj</string>
|
||||
<key>IBOldestOS</key>
|
||||
<integer>5</integer>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>2</integer>
|
||||
<integer>57</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>9D34</string>
|
||||
<key>targetFramework</key>
|
||||
<string>IBCocoaFramework</string>
|
||||
</dict>
|
||||
</plist>
|
||||
Binary file not shown.
@@ -0,0 +1,354 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="5037.3" systemVersion="13C44" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
|
||||
<dependencies>
|
||||
<deployment version="1060" identifier="macosx"/>
|
||||
<development version="5000" identifier="xcode"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="5037.3"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication"/>
|
||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||
<customObject id="-3" userLabel="Application"/>
|
||||
<window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="21" userLabel="Window">
|
||||
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES"/>
|
||||
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
|
||||
<rect key="contentRect" x="447" y="824" width="313" height="173"/>
|
||||
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1028"/>
|
||||
<value key="minSize" type="size" width="213" height="107"/>
|
||||
<view key="contentView" id="2">
|
||||
<rect key="frame" x="0.0" y="0.0" width="313" height="173"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<button id="210">
|
||||
<rect key="frame" x="21" y="112" width="225" height="18"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="check" title="Automatically check for updates" bezelStyle="regularSquare" imagePosition="left" alignment="left" state="on" inset="2" id="248">
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<binding destination="206" name="value" keyPath="automaticallyChecksForUpdates" id="257"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button id="216">
|
||||
<rect key="frame" x="21" y="92" width="228" height="18"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="check" title="Automatically download updates" bezelStyle="regularSquare" imagePosition="left" alignment="left" state="on" inset="2" id="249">
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<binding destination="206" name="value" keyPath="automaticallyDownloadsUpdates" id="259"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button id="220">
|
||||
<rect key="frame" x="21" y="72" width="224" height="18"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="check" title="Send system profile information" bezelStyle="regularSquare" imagePosition="left" alignment="left" state="on" inset="2" id="250">
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<binding destination="206" name="value" keyPath="sendsSystemProfile" id="261"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button id="222">
|
||||
<rect key="frame" x="21" y="52" width="152" height="18"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="check" title="Has launched before" bezelStyle="regularSquare" imagePosition="left" alignment="left" state="on" inset="2" id="251">
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<binding destination="212" name="value" keyPath="values.SUHasLaunchedBefore" id="225"/>
|
||||
</connections>
|
||||
</button>
|
||||
<textField verticalHuggingPriority="750" id="227">
|
||||
<rect key="frame" x="20" y="136" width="106" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<textFieldCell key="cell" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Debug options:" id="252">
|
||||
<font key="font" metaFont="systemBold"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<textField verticalHuggingPriority="750" id="238">
|
||||
<rect key="frame" x="17" y="20" width="157" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Check for updates every" id="253">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<textField verticalHuggingPriority="750" id="242">
|
||||
<rect key="frame" x="240" y="20" width="56" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="seconds" id="255">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<textField verticalHuggingPriority="750" id="240">
|
||||
<rect key="frame" x="179" y="18" width="56" height="22"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="254">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
<connections>
|
||||
<binding destination="206" name="value" keyPath="updateCheckInterval" id="263"/>
|
||||
</connections>
|
||||
</textField>
|
||||
</subviews>
|
||||
</view>
|
||||
</window>
|
||||
<menu title="MainMenu" systemMenu="main" id="29" userLabel="MainMenu">
|
||||
<items>
|
||||
<menuItem title="NewApplication" id="56">
|
||||
<menu key="submenu" title="NewApplication" systemMenu="apple" id="57">
|
||||
<items>
|
||||
<menuItem title="About NewApplication" id="58">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="orderFrontStandardAboutPanel:" target="-2" id="142"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Check for Updates..." keyEquivalent="u" id="207">
|
||||
<connections>
|
||||
<action selector="checkForUpdates:" target="206" id="208"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="196">
|
||||
<modifierMask key="keyEquivalentModifierMask" command="YES"/>
|
||||
</menuItem>
|
||||
<menuItem title="Preferences…" keyEquivalent="," id="129"/>
|
||||
<menuItem isSeparatorItem="YES" id="143">
|
||||
<modifierMask key="keyEquivalentModifierMask" command="YES"/>
|
||||
</menuItem>
|
||||
<menuItem title="Services" id="131">
|
||||
<menu key="submenu" title="Services" systemMenu="services" id="130"/>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="144">
|
||||
<modifierMask key="keyEquivalentModifierMask" command="YES"/>
|
||||
</menuItem>
|
||||
<menuItem title="Hide NewApplication" keyEquivalent="h" id="134">
|
||||
<connections>
|
||||
<action selector="hide:" target="-2" id="152"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Hide Others" keyEquivalent="h" id="145">
|
||||
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
|
||||
<connections>
|
||||
<action selector="hideOtherApplications:" target="-2" id="146"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Show All" id="150">
|
||||
<connections>
|
||||
<action selector="unhideAllApplications:" target="-2" id="153"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="149">
|
||||
<modifierMask key="keyEquivalentModifierMask" command="YES"/>
|
||||
</menuItem>
|
||||
<menuItem title="Quit NewApplication" keyEquivalent="q" id="136">
|
||||
<connections>
|
||||
<action selector="terminate:" target="-2" id="139"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="File" id="83">
|
||||
<menu key="submenu" title="File" id="81">
|
||||
<items>
|
||||
<menuItem title="New" keyEquivalent="n" id="82"/>
|
||||
<menuItem title="Open..." keyEquivalent="o" id="72"/>
|
||||
<menuItem title="Open Recent" id="124">
|
||||
<menu key="submenu" title="Open Recent" systemMenu="recentDocuments" id="125">
|
||||
<items>
|
||||
<menuItem title="Clear Menu" id="126">
|
||||
<connections>
|
||||
<action selector="clearRecentDocuments:" target="-1" id="127"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="79">
|
||||
<modifierMask key="keyEquivalentModifierMask" command="YES"/>
|
||||
</menuItem>
|
||||
<menuItem title="Close" keyEquivalent="w" id="73">
|
||||
<connections>
|
||||
<action selector="performClose:" target="-1" id="193"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Save" keyEquivalent="s" id="75"/>
|
||||
<menuItem title="Save As…" keyEquivalent="S" id="80"/>
|
||||
<menuItem title="Revert" id="112">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="74">
|
||||
<modifierMask key="keyEquivalentModifierMask" command="YES"/>
|
||||
</menuItem>
|
||||
<menuItem title="Page Setup…" keyEquivalent="P" id="77">
|
||||
<connections>
|
||||
<action selector="runPageLayout:" target="-1" id="87"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Print…" keyEquivalent="p" id="78">
|
||||
<connections>
|
||||
<action selector="print:" target="-1" id="86"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Edit" id="163">
|
||||
<menu key="submenu" title="Edit" id="169">
|
||||
<items>
|
||||
<menuItem title="Undo" keyEquivalent="z" id="158">
|
||||
<connections>
|
||||
<action selector="undo:" target="-1" id="180"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Redo" keyEquivalent="Z" id="173">
|
||||
<connections>
|
||||
<action selector="redo:" target="-1" id="178"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="156">
|
||||
<modifierMask key="keyEquivalentModifierMask" command="YES"/>
|
||||
</menuItem>
|
||||
<menuItem title="Cut" keyEquivalent="x" id="160">
|
||||
<connections>
|
||||
<action selector="cut:" target="-1" id="175"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Copy" keyEquivalent="c" id="157">
|
||||
<connections>
|
||||
<action selector="copy:" target="-1" id="181"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Paste" keyEquivalent="v" id="171">
|
||||
<connections>
|
||||
<action selector="paste:" target="-1" id="176"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Paste and Match Style" keyEquivalent="V" id="204">
|
||||
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
|
||||
<connections>
|
||||
<action selector="pasteAsPlainText:" target="-1" id="205"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Delete" id="164">
|
||||
<connections>
|
||||
<action selector="delete:" target="-1" id="195"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Select All" keyEquivalent="a" id="172">
|
||||
<connections>
|
||||
<action selector="selectAll:" target="-1" id="179"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="174">
|
||||
<modifierMask key="keyEquivalentModifierMask" command="YES"/>
|
||||
</menuItem>
|
||||
<menuItem title="Find" id="168">
|
||||
<menu key="submenu" title="Find" id="159">
|
||||
<items>
|
||||
<menuItem title="Find…" tag="1" keyEquivalent="f" id="154">
|
||||
<connections>
|
||||
<action selector="performFindPanelAction:" target="-1" id="199"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Find Next" tag="2" keyEquivalent="g" id="167">
|
||||
<connections>
|
||||
<action selector="performFindPanelAction:" target="-1" id="200"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Find Previous" tag="3" keyEquivalent="G" id="162">
|
||||
<connections>
|
||||
<action selector="performFindPanelAction:" target="-1" id="201"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Use Selection for Find" tag="7" keyEquivalent="e" id="161">
|
||||
<connections>
|
||||
<action selector="performFindPanelAction:" target="-1" id="202"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Jump to Selection" keyEquivalent="j" id="155">
|
||||
<connections>
|
||||
<action selector="centerSelectionInVisibleArea:" target="-1" id="203"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Spelling" id="184">
|
||||
<menu key="submenu" title="Spelling" id="185">
|
||||
<items>
|
||||
<menuItem title="Spelling…" keyEquivalent=":" id="187">
|
||||
<connections>
|
||||
<action selector="showGuessPanel:" target="-1" id="188"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Check Spelling" keyEquivalent=";" id="189">
|
||||
<connections>
|
||||
<action selector="checkSpelling:" target="-1" id="190"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Check Spelling as You Type" id="191">
|
||||
<connections>
|
||||
<action selector="toggleContinuousSpellChecking:" target="-1" id="192"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Window" id="19">
|
||||
<menu key="submenu" title="Window" systemMenu="window" id="24">
|
||||
<items>
|
||||
<menuItem title="Minimize" keyEquivalent="m" id="23">
|
||||
<connections>
|
||||
<action selector="performMiniaturize:" target="-1" id="37"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Zoom" id="197">
|
||||
<connections>
|
||||
<action selector="performZoom:" target="-1" id="198"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="92">
|
||||
<modifierMask key="keyEquivalentModifierMask" command="YES"/>
|
||||
</menuItem>
|
||||
<menuItem title="Bring All to Front" keyEquivalent="p" id="5">
|
||||
<connections>
|
||||
<action selector="arrangeInFront:" target="-1" id="39"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Help" id="103">
|
||||
<menu key="submenu" title="Help" id="106">
|
||||
<items>
|
||||
<menuItem title="NewApplication Help" keyEquivalent="?" id="111">
|
||||
<connections>
|
||||
<action selector="showHelp:" target="-1" id="122"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
<customObject id="206" userLabel="SUUpdater" customClass="SUUpdater"/>
|
||||
<userDefaultsController representsSharedInstance="YES" id="212" userLabel="Shared User Defaults Controller"/>
|
||||
</objects>
|
||||
</document>
|
||||
@@ -1,16 +0,0 @@
|
||||
//
|
||||
// SUVersionComparisonTest.h
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Andy Matuschak on 4/15/08.
|
||||
// Copyright 2008 Andy Matuschak. All rights reserved.
|
||||
//
|
||||
|
||||
#import <SenTestingKit/SenTestingKit.h>
|
||||
|
||||
|
||||
@interface SUVersionComparisonTest : SenTestCase {
|
||||
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -6,12 +6,17 @@
|
||||
// Copyright 2008 Andy Matuschak. All rights reserved.
|
||||
//
|
||||
|
||||
#import "SUVersionComparisonTest.h"
|
||||
#import "SUStandardVersionComparator.h"
|
||||
|
||||
@implementation SUVersionComparisonTest
|
||||
#import <XCTest/XCTest.h>
|
||||
|
||||
#define SUAssertOrder(a,b,c) STAssertTrue([[SUStandardVersionComparator defaultComparator] compareVersion:a toVersion:b] == c, @"b should be newer than a!")
|
||||
@interface SUVersionComparisonTestCase : XCTestCase {
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation SUVersionComparisonTestCase
|
||||
|
||||
#define SUAssertOrder(a,b,c) XCTAssertTrue([[SUStandardVersionComparator defaultComparator] compareVersion:a toVersion:b] == c, @"b should be newer than a!")
|
||||
#define SUAssertAscending(a, b) SUAssertOrder(a,b,NSOrderedAscending)
|
||||
#define SUAssertDescending(a, b) SUAssertOrder(a,b,NSOrderedDescending)
|
||||
#define SUAssertEqual(a, b) SUAssertOrder(a,b,NSOrderedSame)
|
||||
@@ -46,7 +51,9 @@
|
||||
SUAssertAscending(@"1.0b5 (1234)", @"1.0b5 (1235)");
|
||||
SUAssertAscending(@"1.0b5 (1234)", @"1.0.1b5 (1234)");
|
||||
SUAssertAscending(@"1.0.1b5 (1234)", @"1.0.1b6 (1234)");
|
||||
|
||||
SUAssertAscending(@"2.0.0.2429", @"2.0.0.2430");
|
||||
SUAssertAscending(@"1.1.1.1818", @"2.0.0.2430");
|
||||
|
||||
SUAssertAscending(@"3.3 (5847)", @"3.3.1b1 (5902)");
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.yourcompany.${PRODUCT_NAME:identifier}</string>
|
||||
<string>org.andymatuschak.sparkle.${PRODUCT_NAME:rfc1034identifier}</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
|
||||
@@ -1,603 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
|
||||
<data>
|
||||
<int key="IBDocument.SystemTarget">1050</int>
|
||||
<string key="IBDocument.SystemVersion">12B19</string>
|
||||
<string key="IBDocument.InterfaceBuilderVersion">2549</string>
|
||||
<string key="IBDocument.AppKitVersion">1187</string>
|
||||
<string key="IBDocument.HIToolboxVersion">624.00</string>
|
||||
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
|
||||
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="NS.object.0">2549</string>
|
||||
</object>
|
||||
<object class="NSArray" key="IBDocument.IntegratedClassDependencies">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>NSButton</string>
|
||||
<string>NSButtonCell</string>
|
||||
<string>NSCustomObject</string>
|
||||
<string>NSImageCell</string>
|
||||
<string>NSImageView</string>
|
||||
<string>NSSecureTextField</string>
|
||||
<string>NSSecureTextFieldCell</string>
|
||||
<string>NSTextField</string>
|
||||
<string>NSTextFieldCell</string>
|
||||
<string>NSView</string>
|
||||
<string>NSWindowTemplate</string>
|
||||
</object>
|
||||
<object class="NSArray" key="IBDocument.PluginDependencies">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="IBDocument.Metadata">
|
||||
<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
|
||||
<integer value="1" key="NS.object.0"/>
|
||||
</object>
|
||||
<object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSCustomObject" id="1001">
|
||||
<string key="NSClassName">SUPasswordPrompt</string>
|
||||
</object>
|
||||
<object class="NSCustomObject" id="1003">
|
||||
<string key="NSClassName">FirstResponder</string>
|
||||
</object>
|
||||
<object class="NSCustomObject" id="1004">
|
||||
<string key="NSClassName">NSApplication</string>
|
||||
</object>
|
||||
<object class="NSWindowTemplate" id="1005">
|
||||
<int key="NSWindowStyleMask">1</int>
|
||||
<int key="NSWindowBacking">2</int>
|
||||
<string key="NSWindowRect">{{196, 372}, {394, 118}}</string>
|
||||
<int key="NSWTFlags">544736256</int>
|
||||
<string key="NSWindowTitle">كلمة السر</string>
|
||||
<string key="NSWindowClass">NSWindow</string>
|
||||
<nil key="NSViewClass"/>
|
||||
<nil key="NSUserInterfaceItemIdentifier"/>
|
||||
<object class="NSView" key="NSWindowView" id="1006">
|
||||
<reference key="NSNextResponder"/>
|
||||
<int key="NSvFlags">256</int>
|
||||
<object class="NSMutableArray" key="NSSubviews">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSSecureTextField" id="702493616">
|
||||
<reference key="NSNextResponder" ref="1006"/>
|
||||
<int key="NSvFlags">290</int>
|
||||
<string key="NSFrame">{{20, 49}, {195, 22}}</string>
|
||||
<reference key="NSSuperview" ref="1006"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="904376142"/>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSSecureTextFieldCell" key="NSCell" id="952445980">
|
||||
<int key="NSCellFlags">342884416</int>
|
||||
<int key="NSCellFlags2">272630784</int>
|
||||
<string key="NSContents"/>
|
||||
<object class="NSFont" key="NSSupport" id="761309253">
|
||||
<string key="NSName">LucidaGrande</string>
|
||||
<double key="NSSize">13</double>
|
||||
<int key="NSfFlags">1044</int>
|
||||
</object>
|
||||
<reference key="NSControlView" ref="702493616"/>
|
||||
<bool key="NSDrawsBackground">YES</bool>
|
||||
<object class="NSColor" key="NSBackgroundColor">
|
||||
<int key="NSColorSpace">6</int>
|
||||
<string key="NSCatalogName">System</string>
|
||||
<string key="NSColorName">textBackgroundColor</string>
|
||||
<object class="NSColor" key="NSColor">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MQA</bytes>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSColor" key="NSTextColor">
|
||||
<int key="NSColorSpace">6</int>
|
||||
<string key="NSCatalogName">System</string>
|
||||
<string key="NSColorName">textColor</string>
|
||||
<object class="NSColor" key="NSColor" id="1044763220">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MAA</bytes>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSArray" key="NSAllowedInputLocales">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>NSAllRomanInputSourcesLocaleIdentifier</string>
|
||||
</object>
|
||||
</object>
|
||||
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
|
||||
</object>
|
||||
<object class="NSTextField" id="904376142">
|
||||
<reference key="NSNextResponder" ref="1006"/>
|
||||
<int key="NSvFlags">292</int>
|
||||
<string key="NSFrame">{{220, 51}, {68, 17}}</string>
|
||||
<reference key="NSSuperview" ref="1006"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="17192395"/>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSTextFieldCell" key="NSCell" id="561848322">
|
||||
<int key="NSCellFlags">68157504</int>
|
||||
<int key="NSCellFlags2">71304192</int>
|
||||
<string key="NSContents">كلمة السر:</string>
|
||||
<reference key="NSSupport" ref="761309253"/>
|
||||
<reference key="NSControlView" ref="904376142"/>
|
||||
<object class="NSColor" key="NSBackgroundColor" id="768468736">
|
||||
<int key="NSColorSpace">6</int>
|
||||
<string key="NSCatalogName">System</string>
|
||||
<string key="NSColorName">controlColor</string>
|
||||
<object class="NSColor" key="NSColor">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSColor" key="NSTextColor" id="294895527">
|
||||
<int key="NSColorSpace">6</int>
|
||||
<string key="NSCatalogName">System</string>
|
||||
<string key="NSColorName">controlTextColor</string>
|
||||
<reference key="NSColor" ref="1044763220"/>
|
||||
</object>
|
||||
</object>
|
||||
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
|
||||
</object>
|
||||
<object class="NSButton" id="17192395">
|
||||
<reference key="NSNextResponder" ref="1006"/>
|
||||
<int key="NSvFlags">289</int>
|
||||
<string key="NSFrame">{{14, 13}, {83, 32}}</string>
|
||||
<reference key="NSSuperview" ref="1006"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="253260072"/>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSButtonCell" key="NSCell" id="611796391">
|
||||
<int key="NSCellFlags">67108864</int>
|
||||
<int key="NSCellFlags2">134217728</int>
|
||||
<string key="NSContents">فتح القفل</string>
|
||||
<reference key="NSSupport" ref="761309253"/>
|
||||
<reference key="NSControlView" ref="17192395"/>
|
||||
<int key="NSButtonFlags">-2038284288</int>
|
||||
<int key="NSButtonFlags2">129</int>
|
||||
<string key="NSAlternateContents"/>
|
||||
<string type="base64-UTF8" key="NSKeyEquivalent">DQ</string>
|
||||
<int key="NSPeriodicDelay">200</int>
|
||||
<int key="NSPeriodicInterval">25</int>
|
||||
</object>
|
||||
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
|
||||
</object>
|
||||
<object class="NSButton" id="253260072">
|
||||
<reference key="NSNextResponder" ref="1006"/>
|
||||
<int key="NSvFlags">289</int>
|
||||
<string key="NSFrame">{{97, 13}, {82, 32}}</string>
|
||||
<reference key="NSSuperview" ref="1006"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="470601067"/>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSButtonCell" key="NSCell" id="600635121">
|
||||
<int key="NSCellFlags">67108864</int>
|
||||
<int key="NSCellFlags2">134217728</int>
|
||||
<string key="NSContents">إلغاء</string>
|
||||
<reference key="NSSupport" ref="761309253"/>
|
||||
<reference key="NSControlView" ref="253260072"/>
|
||||
<int key="NSButtonFlags">-2038284288</int>
|
||||
<int key="NSButtonFlags2">129</int>
|
||||
<string key="NSAlternateContents"/>
|
||||
<string type="base64-UTF8" key="NSKeyEquivalent">Gw</string>
|
||||
<int key="NSPeriodicDelay">200</int>
|
||||
<int key="NSPeriodicInterval">25</int>
|
||||
</object>
|
||||
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
|
||||
</object>
|
||||
<object class="NSTextField" id="141023835">
|
||||
<reference key="NSNextResponder" ref="1006"/>
|
||||
<int key="NSvFlags">266</int>
|
||||
<string key="NSFrame">{{17, 86}, {271, 17}}</string>
|
||||
<reference key="NSSuperview" ref="1006"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="702493616"/>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSTextFieldCell" key="NSCell" id="229940026">
|
||||
<int key="NSCellFlags">67108864</int>
|
||||
<int key="NSCellFlags2">71303168</int>
|
||||
<string key="NSContents">هذا التحديث مقفول بكلمة سر.</string>
|
||||
<object class="NSFont" key="NSSupport">
|
||||
<string key="NSName">LucidaGrande-Bold</string>
|
||||
<double key="NSSize">13</double>
|
||||
<int key="NSfFlags">16</int>
|
||||
</object>
|
||||
<reference key="NSControlView" ref="141023835"/>
|
||||
<reference key="NSBackgroundColor" ref="768468736"/>
|
||||
<reference key="NSTextColor" ref="294895527"/>
|
||||
</object>
|
||||
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
|
||||
</object>
|
||||
<object class="NSImageView" id="470601067">
|
||||
<reference key="NSNextResponder" ref="1006"/>
|
||||
<int key="NSvFlags">268</int>
|
||||
<object class="NSMutableSet" key="NSDragTypes">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSArray" key="set.sortedObjects">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>Apple PDF pasteboard type</string>
|
||||
<string>Apple PICT pasteboard type</string>
|
||||
<string>Apple PNG pasteboard type</string>
|
||||
<string>NSFilenamesPboardType</string>
|
||||
<string>NeXT Encapsulated PostScript v1.2 pasteboard type</string>
|
||||
<string>NeXT TIFF v4.0 pasteboard type</string>
|
||||
</object>
|
||||
</object>
|
||||
<string key="NSFrame">{{310, 39}, {64, 64}}</string>
|
||||
<reference key="NSSuperview" ref="1006"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView"/>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSImageCell" key="NSCell" id="415127758">
|
||||
<int key="NSCellFlags">134217728</int>
|
||||
<int key="NSCellFlags2">33554432</int>
|
||||
<int key="NSAlign">0</int>
|
||||
<int key="NSScale">0</int>
|
||||
<int key="NSStyle">0</int>
|
||||
<bool key="NSAnimates">NO</bool>
|
||||
</object>
|
||||
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
|
||||
<bool key="NSEditable">YES</bool>
|
||||
</object>
|
||||
</object>
|
||||
<string key="NSFrameSize">{394, 118}</string>
|
||||
<reference key="NSSuperview"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="141023835"/>
|
||||
</object>
|
||||
<string key="NSScreenRect">{{0, 0}, {1280, 778}}</string>
|
||||
<string key="NSMaxSize">{10000000000000, 10000000000000}</string>
|
||||
<bool key="NSWindowIsRestorable">YES</bool>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBObjectContainer" key="IBDocument.Objects">
|
||||
<object class="NSMutableArray" key="connectionRecords">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBOutletConnection" key="connection">
|
||||
<string key="label">mPasswordField</string>
|
||||
<reference key="source" ref="1001"/>
|
||||
<reference key="destination" ref="702493616"/>
|
||||
</object>
|
||||
<int key="connectionID">19</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBOutletConnection" key="connection">
|
||||
<string key="label">window</string>
|
||||
<reference key="source" ref="1001"/>
|
||||
<reference key="destination" ref="1005"/>
|
||||
</object>
|
||||
<int key="connectionID">20</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBActionConnection" key="connection">
|
||||
<string key="label">cancel:</string>
|
||||
<reference key="source" ref="1001"/>
|
||||
<reference key="destination" ref="253260072"/>
|
||||
</object>
|
||||
<int key="connectionID">21</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBActionConnection" key="connection">
|
||||
<string key="label">accept:</string>
|
||||
<reference key="source" ref="1001"/>
|
||||
<reference key="destination" ref="17192395"/>
|
||||
</object>
|
||||
<int key="connectionID">22</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBOutletConnection" key="connection">
|
||||
<string key="label">mTextDescription</string>
|
||||
<reference key="source" ref="1001"/>
|
||||
<reference key="destination" ref="141023835"/>
|
||||
</object>
|
||||
<int key="connectionID">25</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBOutletConnection" key="connection">
|
||||
<string key="label">mIconView</string>
|
||||
<reference key="source" ref="1001"/>
|
||||
<reference key="destination" ref="470601067"/>
|
||||
</object>
|
||||
<int key="connectionID">26</int>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBMutableOrderedSet" key="objectRecords">
|
||||
<object class="NSArray" key="orderedObjects">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">0</int>
|
||||
<object class="NSArray" key="object" id="0">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
</object>
|
||||
<reference key="children" ref="1000"/>
|
||||
<nil key="parent"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">-2</int>
|
||||
<reference key="object" ref="1001"/>
|
||||
<reference key="parent" ref="0"/>
|
||||
<string key="objectName">File's Owner</string>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">-1</int>
|
||||
<reference key="object" ref="1003"/>
|
||||
<reference key="parent" ref="0"/>
|
||||
<string key="objectName">First Responder</string>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">-3</int>
|
||||
<reference key="object" ref="1004"/>
|
||||
<reference key="parent" ref="0"/>
|
||||
<string key="objectName">Application</string>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">1</int>
|
||||
<reference key="object" ref="1005"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="1006"/>
|
||||
</object>
|
||||
<reference key="parent" ref="0"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">2</int>
|
||||
<reference key="object" ref="1006"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="470601067"/>
|
||||
<reference ref="141023835"/>
|
||||
<reference ref="904376142"/>
|
||||
<reference ref="702493616"/>
|
||||
<reference ref="17192395"/>
|
||||
<reference ref="253260072"/>
|
||||
</object>
|
||||
<reference key="parent" ref="1005"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">3</int>
|
||||
<reference key="object" ref="702493616"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="952445980"/>
|
||||
</object>
|
||||
<reference key="parent" ref="1006"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">4</int>
|
||||
<reference key="object" ref="952445980"/>
|
||||
<reference key="parent" ref="702493616"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">5</int>
|
||||
<reference key="object" ref="904376142"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="561848322"/>
|
||||
</object>
|
||||
<reference key="parent" ref="1006"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">6</int>
|
||||
<reference key="object" ref="561848322"/>
|
||||
<reference key="parent" ref="904376142"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">7</int>
|
||||
<reference key="object" ref="17192395"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="611796391"/>
|
||||
</object>
|
||||
<reference key="parent" ref="1006"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">8</int>
|
||||
<reference key="object" ref="611796391"/>
|
||||
<reference key="parent" ref="17192395"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">9</int>
|
||||
<reference key="object" ref="253260072"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="600635121"/>
|
||||
</object>
|
||||
<reference key="parent" ref="1006"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">10</int>
|
||||
<reference key="object" ref="600635121"/>
|
||||
<reference key="parent" ref="253260072"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">15</int>
|
||||
<reference key="object" ref="141023835"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="229940026"/>
|
||||
</object>
|
||||
<reference key="parent" ref="1006"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">16</int>
|
||||
<reference key="object" ref="229940026"/>
|
||||
<reference key="parent" ref="141023835"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">17</int>
|
||||
<reference key="object" ref="470601067"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="415127758"/>
|
||||
</object>
|
||||
<reference key="parent" ref="1006"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">18</int>
|
||||
<reference key="object" ref="415127758"/>
|
||||
<reference key="parent" ref="470601067"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="flattenedProperties">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSArray" key="dict.sortedKeys">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>-1.IBPluginDependency</string>
|
||||
<string>-2.IBPluginDependency</string>
|
||||
<string>-3.IBPluginDependency</string>
|
||||
<string>1.IBPluginDependency</string>
|
||||
<string>1.IBWindowTemplateEditedContentRect</string>
|
||||
<string>1.NSWindowTemplate.visibleAtLaunch</string>
|
||||
<string>10.IBPluginDependency</string>
|
||||
<string>15.IBPluginDependency</string>
|
||||
<string>16.IBPluginDependency</string>
|
||||
<string>17.IBPluginDependency</string>
|
||||
<string>18.IBPluginDependency</string>
|
||||
<string>2.IBPluginDependency</string>
|
||||
<string>3.IBPluginDependency</string>
|
||||
<string>4.IBPluginDependency</string>
|
||||
<string>5.IBPluginDependency</string>
|
||||
<string>6.IBPluginDependency</string>
|
||||
<string>7.IBPluginDependency</string>
|
||||
<string>8.IBPluginDependency</string>
|
||||
<string>9.IBPluginDependency</string>
|
||||
</object>
|
||||
<object class="NSArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>{{316, 826}, {362, 138}}</string>
|
||||
<boolean value="NO"/>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="unlocalizedProperties">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference key="dict.sortedKeys" ref="0"/>
|
||||
<reference key="dict.values" ref="0"/>
|
||||
</object>
|
||||
<nil key="activeLocalization"/>
|
||||
<object class="NSMutableDictionary" key="localizations">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference key="dict.sortedKeys" ref="0"/>
|
||||
<reference key="dict.values" ref="0"/>
|
||||
</object>
|
||||
<nil key="sourceID"/>
|
||||
<int key="maxID">26</int>
|
||||
</object>
|
||||
<object class="IBClassDescriber" key="IBDocument.Classes">
|
||||
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">SUPasswordPrompt</string>
|
||||
<string key="superclassName">SUWindowController</string>
|
||||
<object class="NSMutableDictionary" key="actions">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSArray" key="dict.sortedKeys">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>accept:</string>
|
||||
<string>cancel:</string>
|
||||
</object>
|
||||
<object class="NSArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>id</string>
|
||||
<string>id</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="actionInfosByName">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSArray" key="dict.sortedKeys">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>accept:</string>
|
||||
<string>cancel:</string>
|
||||
</object>
|
||||
<object class="NSArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="IBActionInfo">
|
||||
<string key="name">accept:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBActionInfo">
|
||||
<string key="name">cancel:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="outlets">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSArray" key="dict.sortedKeys">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>mIconView</string>
|
||||
<string>mPasswordField</string>
|
||||
<string>mTextDescription</string>
|
||||
</object>
|
||||
<object class="NSArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>NSImageView</string>
|
||||
<string>NSSecureTextField</string>
|
||||
<string>NSTextField</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSArray" key="dict.sortedKeys">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>mIconView</string>
|
||||
<string>mPasswordField</string>
|
||||
<string>mTextDescription</string>
|
||||
</object>
|
||||
<object class="NSArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="IBToOneOutletInfo">
|
||||
<string key="name">mIconView</string>
|
||||
<string key="candidateClassName">NSImageView</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo">
|
||||
<string key="name">mPasswordField</string>
|
||||
<string key="candidateClassName">NSSecureTextField</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo">
|
||||
<string key="name">mTextDescription</string>
|
||||
<string key="candidateClassName">NSTextField</string>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
<string key="minorKey">./Classes/SUPasswordPrompt.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">SUWindowController</string>
|
||||
<string key="superclassName">NSWindowController</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
<string key="minorKey">./Classes/SUWindowController.h</string>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<int key="IBDocument.localizationMode">0</int>
|
||||
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
|
||||
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencies">
|
||||
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string>
|
||||
<integer value="1050" key="NS.object.0"/>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
|
||||
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string>
|
||||
<integer value="3000" key="NS.object.0"/>
|
||||
</object>
|
||||
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
|
||||
<int key="IBDocument.defaultPropertyAccessControl">3</int>
|
||||
</data>
|
||||
</archive>
|
||||
Loaded 100 of 249 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user