Skip to content
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

Merged
merged 7 commits into from Oct 18, 2016

Conversation

@joshaber
Copy link
Contributor

joshaber commented Oct 14, 2016

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

@@ -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;

This comment has been minimized.

Copy link
@keithduncan

keithduncan Oct 17, 2016

Member

Should this be 8 to distinguish from SQRLUpdaterErrorInvalidServerBody

This comment has been minimized.

Copy link
@joshaber

joshaber Oct 17, 2016

Author Contributor

Laugh on line!!

BOOL readOnlyVolume = [self isRunningOnReadOnlyVolume];
if (readOnlyVolume) {
NSDictionary *errorInfo = @{
NSLocalizedDescriptionKey: NSLocalizedString(@"Read-only volume", nil),

This comment has been minimized.

Copy link
@keithduncan

keithduncan Oct 17, 2016

Member

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);

This comment has been minimized.

Copy link
@keithduncan

keithduncan Oct 17, 2016

Member

This syscall should be error handled, should we default to true in the error case?

@joshaber

This comment has been minimized.

Copy link
Contributor Author

joshaber commented Oct 17, 2016

🗝

@keithduncan

This comment has been minimized.

Copy link
Member

keithduncan commented Oct 18, 2016

urban_cookie_collective

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.