From aa7c46ba4f6cfa8fff161d54a9ce7ec3d614ba01 Mon Sep 17 00:00:00 2001 From: Zorg Date: Mon, 11 Apr 2016 03:15:36 -0400 Subject: [PATCH] Check the bundle's parent directory for writability too This is to decide if we should allow automatic downloading & installing of updates or not. --- Sparkle/SUHost.m | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Sparkle/SUHost.m b/Sparkle/SUHost.m index 00ba50d1..986c983d 100644 --- a/Sparkle/SUHost.m +++ b/Sparkle/SUHost.m @@ -71,7 +71,10 @@ } // Can we automatically update in the background without bugging the user (e.g, with a administrator password prompt)? - return [[NSFileManager defaultManager] isWritableFileAtPath:self.bundlePath]; + // Note it's very well possible to have the bundle be writable but not be able to write into the parent directory + // And if the bundle isn't writable, but we can write into the parent directory, we will still need to authorize to replace it + NSString *bundlePath = [self bundlePath]; + return [[NSFileManager defaultManager] isWritableFileAtPath:bundlePath.stringByDeletingLastPathComponent] && [[NSFileManager defaultManager] isWritableFileAtPath:bundlePath]; } - (NSString *)appCachePath