mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-24 04:38:16 +00:00
Only use SUFileManager in debug mode for the test app
This way we don't have to export it in release mode
This commit is contained in:
1 parent
51e1e1c646
commit
e03607a2d6
2 files changed
+11
-2
No files matched your search
Vendored
+1
-1
@@ -14,7 +14,7 @@
|
||||
* perform them normally as the running user. All operations on this class may be used on thread other than the main thread.
|
||||
* This class provides basic file operations and stays away from including much application-level logic.
|
||||
*/
|
||||
SU_EXPORT @interface SUFileManager : NSObject
|
||||
@interface SUFileManager : NSObject
|
||||
|
||||
/**
|
||||
* Creates a file manager that allows or disallows authorizing for file operations
|
||||
|
||||
@@ -41,7 +41,14 @@ static NSString * const UPDATED_VERSION = @"2.0";
|
||||
[[NSApplication sharedApplication] terminate:nil];
|
||||
}
|
||||
|
||||
// Apple's file manager may not work well over the network (on OS X 10.11.4 as of writing this), but at the same time
|
||||
// I don't want to have to export SUFileManager in release mode. The test app is primarily
|
||||
// aimed to be used in debug mode, so I think this is a good compromise
|
||||
#ifdef DEBUG
|
||||
SUFileManager *fileManager = [SUFileManager fileManagerAllowingAuthorization:NO];
|
||||
#else
|
||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||
#endif
|
||||
|
||||
// Locate user's cache directory
|
||||
NSError *cacheError = nil;
|
||||
@@ -168,7 +175,9 @@ static NSString * const UPDATED_VERSION = @"2.0";
|
||||
// Copy our appcast over to the server directory
|
||||
NSURL *appcastDestinationURL = [[serverDirectoryURL URLByAppendingPathComponent:appcastName] URLByAppendingPathExtension:appcastExtension];
|
||||
NSError *copyAppcastError = nil;
|
||||
if (![fileManager copyItemAtURL:[mainBundle URLForResource:appcastName withExtension:appcastExtension] toURL:appcastDestinationURL error:©AppcastError]) {
|
||||
NSURL *appcastURL = [mainBundle URLForResource:appcastName withExtension:appcastExtension];
|
||||
assert(appcastURL != nil);
|
||||
if (![fileManager copyItemAtURL:appcastURL toURL:appcastDestinationURL error:©AppcastError]) {
|
||||
NSLog(@"Failed to copy appcast into cache directory with error %@", copyAppcastError);
|
||||
assert(NO);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user