From 97c71ef700d12a9d4ec2a58292bd9d433e288d6d Mon Sep 17 00:00:00 2001 From: Andy Matuschak Date: Mon, 7 May 2012 19:39:31 -0700 Subject: [PATCH] Fixes #170: An environment variable set by Sparkle --- SUPipedUnarchiver.m | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/SUPipedUnarchiver.m b/SUPipedUnarchiver.m index 5c82dbc8..08246647 100644 --- a/SUPipedUnarchiver.m +++ b/SUPipedUnarchiver.m @@ -67,6 +67,7 @@ fp = fopen([archivePath fileSystemRepresentation], "r"); if (!fp) goto reportError; + char *oldDestinationString = getenv("DESTINATION"); setenv("DESTINATION", [[archivePath stringByDeletingLastPathComponent] fileSystemRepresentation], 1); cmdFP = popen([command fileSystemRepresentation], "w"); size_t written; @@ -99,6 +100,10 @@ reportError: finally: if (fp) fclose(fp); + if (oldDestinationString) + setenv("DESTINATION", oldDestinationString, 1); + else + unsetenv("DESTINATION"); [pool release]; }