-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error if there's an update available but the app's on a read-only volume #186
Conversation
@@ -32,6 +33,9 @@ | |||
const NSInteger SQRLUpdaterErrorInvalidJSON = 6; | |||
const NSInteger SQRLUpdaterErrorInvalidServerBody = 7; | |||
|
|||
/// The application's being run on a read-only volume. | |||
const NSInteger SQRLUpdaterErrorReadOnlyVolume = 7; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be 8
to distinguish from SQRLUpdaterErrorInvalidServerBody
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Laugh on line!!
BOOL readOnlyVolume = [self isRunningOnReadOnlyVolume]; | ||
if (readOnlyVolume) { | ||
NSDictionary *errorInfo = @{ | ||
NSLocalizedDescriptionKey: NSLocalizedString(@"Read-only volume", nil), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you make this @"Cannot update while running on a read-only volume"
- (BOOL)isRunningOnReadOnlyVolume { | ||
struct statfs statfsInfo; | ||
NSURL *bundleURL = NSRunningApplication.currentApplication.bundleURL; | ||
statfs(bundleURL.fileSystemRepresentation, &statfsInfo); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This syscall should be error handled, should we default to true
in the error case?
🗝 |
Addresses #182
I think it makes sense to only error once we know that it matters, i.e., that there's an update available. Otherwise it'd just be an annoying error when the user first downloads the app.
The read-only volume check is taken from Sparkle: https://github.com/sparkle-project/Sparkle/blob/3a5c620b60f483b71f8c28573ac29bf85fda6193/Sparkle/SUHost.m#L178-L183