From 978973fac9ccdb9069aaabe0651475079e1a336b Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Thu, 11 Feb 2016 17:13:06 -0800 Subject: [PATCH] iOS: Inflate the Xcode project into a "Generated" subdirectory --- packages/flutter_tools/lib/src/commands/ios.dart | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/flutter_tools/lib/src/commands/ios.dart b/packages/flutter_tools/lib/src/commands/ios.dart index 160b085c0b..d5661658ed 100644 --- a/packages/flutter_tools/lib/src/commands/ios.dart +++ b/packages/flutter_tools/lib/src/commands/ios.dart @@ -59,6 +59,11 @@ class IOSCommand extends FlutterCommand { tempFile.writeAsBytesSync(archiveBytes); try { + // Remove the old generated project if one is present + runCheckedSync(['/bin/rm', '-rf', directory]); + // Create the directory so unzip can write to it + runCheckedSync(['/bin/mkdir', '-p', directory]); + // Unzip the Xcode project into the new empty directory runCheckedSync(['/usr/bin/unzip', tempFile.path, '-d', directory]); } catch (error) { return false; @@ -111,7 +116,7 @@ class IOSCommand extends FlutterCommand { Future _runInitCommand() async { // Step 1: Fetch the archive from the cloud - String xcodeprojPath = path.join(Directory.current.path, "ios"); + String xcodeprojPath = path.join(Directory.current.path, "ios", "Generated"); List archiveBytes = await _fetchXcodeArchive(); if (archiveBytes.isEmpty) { @@ -122,9 +127,7 @@ class IOSCommand extends FlutterCommand { // Step 2: Inflate the archive into the user project directory bool result = await _inflateXcodeArchive(xcodeprojPath, archiveBytes); if (!result) { - printError("Error: Could not init the Xcode project: the 'ios' directory already exists."); - printError("To proceed, remove the 'ios' directory and try again."); - printError("Warning: You may have made manual changes to files in the 'ios' directory."); + printError("Could not inflate the Xcode project archive."); return 1; }