From b4f1f67ddbb7cc8508c4fd9e205c56d5c49c70ea Mon Sep 17 00:00:00 2001 From: Zorg Date: Sat, 28 May 2016 23:15:54 -0400 Subject: [PATCH] Prevent using wrong combination of flags --- sparkle-cli/main.m | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/sparkle-cli/main.m b/sparkle-cli/main.m index 53df0716..5346cfa9 100644 --- a/sparkle-cli/main.m +++ b/sparkle-cli/main.m @@ -119,6 +119,16 @@ int main(int argc, char **argv) return EXIT_FAILURE; } + if (probeForUpdates && (applicationPath != nil || deferInstall || checkForUpdatesNow || interactive)) { + fprintf(stderr, "Error: --%s does not work together with --%s, --%s, --%s, --%s\n", PROBE_FLAG, APPLICATION_FLAG, DEFER_FLAG, CHECK_NOW_FLAG, INTERACTIVE_FLAG); + return EXIT_FAILURE; + } + + if (interactive && deferInstall) { + fprintf(stderr, "Error: --%s does not work together with --%s\n", INTERACTIVE_FLAG, DEFER_FLAG); + return EXIT_FAILURE; + } + SUUpdatePermission *updatePermission = nil; if (grantAutomaticChecking) { updatePermission = [SUUpdatePermission updatePermissionWithChoice:SUAutomaticallyCheck sendProfile:sendProfile]; @@ -127,7 +137,6 @@ int main(int argc, char **argv) SUCommandLineDriver *driver = [[SUCommandLineDriver alloc] initWithUpdateBundlePath:updatePath applicationBundlePath:applicationPath updatePermission:updatePermission deferInstallation:deferInstall interactiveInstallation:interactive verbose:verbose]; if (driver == nil) { fprintf(stderr, "Error: Failed to initialize updater. Are the bundle paths provided valid?\n"); - printUsage(argv); return EXIT_FAILURE; }