From 079666643dfbef582c9818a390815d030552d006 Mon Sep 17 00:00:00 2001 From: Kevin Wojniak Date: Sun, 27 Sep 2015 12:31:45 -0700 Subject: [PATCH] Set the task working directories instead of changing the process working directory --- TestApplication/SUTestApplicationDelegate.m | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/TestApplication/SUTestApplicationDelegate.m b/TestApplication/SUTestApplicationDelegate.m index d62353c6..481222d2 100644 --- a/TestApplication/SUTestApplicationDelegate.m +++ b/TestApplication/SUTestApplicationDelegate.m @@ -92,14 +92,15 @@ static NSString * const UPDATED_VERSION = @"2.0"; assert(wroteInfoFile); // Change current working directory so web server knows where to list files - BOOL changedCurrentWorkingDirectory = [fileManager changeCurrentDirectoryPath:serverDirectoryURL.path]; - assert(changedCurrentWorkingDirectory); + NSString *serverDirectoryPath = serverDirectoryURL.path; + assert(serverDirectoryPath != nil); // Create the archive for our update NSString *zipName = @"Sparkle_Test_App.zip"; NSTask *dittoTask = [[NSTask alloc] init]; dittoTask.launchPath = @"/usr/bin/ditto"; dittoTask.arguments = @[@"-c", @"-k", @"--sequesterRsrc", @"--keepParent", destinationBundleURL.lastPathComponent, zipName]; + dittoTask.currentDirectoryPath = serverDirectoryPath; [dittoTask launch]; [dittoTask waitUntilExit]; @@ -175,7 +176,13 @@ static NSString * const UPDATED_VERSION = @"2.0"; } // Finally start the server - self.serverTask = [NSTask launchedTaskWithLaunchPath:@"/usr/bin/python" arguments:@[@"-m", @"SimpleHTTPServer", @"1337"]]; + NSTask *serverTask = [[NSTask alloc] init]; + serverTask.launchPath = @"/usr/bin/python"; + assert([[NSFileManager defaultManager] fileExistsAtPath:serverTask.launchPath]); + serverTask.arguments = @[@"-m", @"SimpleHTTPServer", @"1337"]; + serverTask.currentDirectoryPath = serverDirectoryPath; + [serverTask launch]; + self.serverTask = serverTask; // Show the Settings window self.updateSettingsWindowController = [[SUUpdateSettingsWindowController alloc] init];