Fixes #170: An environment variable set by Sparkle

This commit is contained in:
Andy Matuschak committed 2012-05-07 19:39:31 -07:00
1 parent 6b7752792d
commit 97c71ef700
1 file changed
+5
+5
View File
@@ -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];
}