mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-28 05:14:34 +00:00
Use class constructor instead of an init method for SUFileManager
I think it's more natural this way
This commit is contained in:
1 parent
9d06f5bc4d
commit
3c957096c6
4 files changed
+12
-6
No files matched your search
Vendored
+1
-1
@@ -452,7 +452,7 @@
|
||||
if (relaunchPathToCopy != nil) {
|
||||
NSString *targetPath = [self.host.appCachePath stringByAppendingPathComponent:[relaunchPathToCopy lastPathComponent]];
|
||||
|
||||
SUFileManager *fileManager = [[SUFileManager alloc] initAllowingAuthorization:NO];
|
||||
SUFileManager *fileManager = [SUFileManager fileManagerAllowingAuthorization:NO];
|
||||
NSError *error = nil;
|
||||
|
||||
NSURL *relaunchURLToCopy = [NSURL fileURLWithPath:relaunchPathToCopy];
|
||||
|
||||
Vendored
+3
-3
@@ -16,14 +16,14 @@
|
||||
@interface SUFileManager : NSObject
|
||||
|
||||
/**
|
||||
* Initializes a file manager
|
||||
* Creates a file manager that allows or disallows authorizing for file operations
|
||||
* @param allowsAuthorization Specifies whether operations invoked on this instance are allowed to acquire authorization in order
|
||||
* to perform file operations when read or write access is denied
|
||||
* @return A new file manager instance
|
||||
*
|
||||
* This method just initializes the file manager. It doesn't acquire authorization immediately if allowsAuthorization is YES
|
||||
* This method just creates the file manager. It doesn't acquire authorization immediately if allowsAuthorization is YES
|
||||
*/
|
||||
- (id)initAllowingAuthorization:(BOOL)allowsAuthorization;
|
||||
+ (instancetype)fileManagerAllowingAuthorization:(BOOL)allowsAuthorization;
|
||||
|
||||
/**
|
||||
* Creates a temporary directory on the same volume as a provided URL
|
||||
|
||||
Vendored
+7
-1
@@ -55,7 +55,7 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
|
||||
BOOL _allowsAuthorization;
|
||||
}
|
||||
|
||||
- (id)initAllowingAuthorization:(BOOL)allowsAuthorization
|
||||
- (instancetype)initAllowingAuthorization:(BOOL)allowsAuthorization
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil) {
|
||||
@@ -65,6 +65,12 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
+ (instancetype)fileManagerAllowingAuthorization:(BOOL)allowsAuthorization
|
||||
{
|
||||
return [[self alloc] initAllowingAuthorization:allowsAuthorization];
|
||||
}
|
||||
|
||||
// Acquires an authorization reference which is intended to be used for future authorized file operations
|
||||
- (BOOL)_acquireAuthorizationWithError:(NSError *__autoreleasing *)error
|
||||
{
|
||||
|
||||
Vendored
+1
-1
@@ -42,7 +42,7 @@
|
||||
return NO;
|
||||
}
|
||||
|
||||
SUFileManager *fileManager = [[SUFileManager alloc] initAllowingAuthorization:YES];
|
||||
SUFileManager *fileManager = [SUFileManager fileManagerAllowingAuthorization:YES];
|
||||
|
||||
// Create a temporary directory for our new app that resides on our destination's volume
|
||||
NSURL *tempNewDirectoryURL = [fileManager makeTemporaryDirectoryWithPreferredName:[installationURL.lastPathComponent.stringByDeletingPathExtension stringByAppendingString:@" (Incomplete Update)"] appropriateForDirectoryURL:installationURL.URLByDeletingLastPathComponent error:error];
|
||||
|
||||
Reference in new issue
Block a user