diff options
author | Alan McGovern <alan.mcgovern@gmail.com> | 2011-11-23 05:51:17 +0400 |
---|---|---|
committer | Alan McGovern <alan.mcgovern@gmail.com> | 2011-11-23 05:56:42 +0400 |
commit | 0f61195b85c1301e16fb120fc92d373378a4ef8a (patch) | |
tree | 07adbbbddda07b2df1372188e2411b5e33ee7d7e /main/src | |
parent | 29dd8167aee2319e7ebdf063988ef35eb5faebb9 (diff) |
[MacDev] Fix a bug where a new xib/storyboard would not sync out
When we add files to a monomac/monotouch project while the project
is open in xcode, we need to ensure that the freshly added files are
synced to the *new* directory, not the old directory. We also need
to ensure that xcode remains open after the sync happens.
Diffstat (limited to 'main/src')
3 files changed, 19 insertions, 4 deletions
diff --git a/main/src/addins/MonoDevelop.MacDev/XcodeSyncing/XcodeMonitor.cs b/main/src/addins/MonoDevelop.MacDev/XcodeSyncing/XcodeMonitor.cs index d47896e1ae..ee52421f36 100644 --- a/main/src/addins/MonoDevelop.MacDev/XcodeSyncing/XcodeMonitor.cs +++ b/main/src/addins/MonoDevelop.MacDev/XcodeSyncing/XcodeMonitor.cs @@ -46,7 +46,7 @@ namespace MonoDevelop.MacDev.XcodeSyncing class XcodeMonitor { FilePath originalProjectDir; - int nextHackDir = 0; + static int nextHackDir = 0; string name; FilePath xcproj, projectDir; @@ -124,6 +124,7 @@ namespace MonoDevelop.MacDev.XcodeSyncing if (removedOldProject) { HackRelocateProject (); + ctx.ProjectDir = projectDir; } foreach (var item in items) { @@ -142,6 +143,7 @@ namespace MonoDevelop.MacDev.XcodeSyncing pendingProjectWrite = emptyProject; } + OpenProject (); monitor.EndTask (); monitor.ReportSuccess (GettextCatalog.GetString ("Xcode project updated.")); } @@ -335,6 +337,14 @@ namespace MonoDevelop.MacDev.XcodeSyncing return success; } + public bool OpenProject () + { + SyncProject (); + var success = AppleScript.Run (XCODE_OPEN_PROJECT, AppleSdkSettings.XcodePath, projectDir) == "true"; + XC4Debug.Log ("Opening project: {0}", success); + return success; + } + public bool CloseFile (string fileName) { if (!CheckRunning ()) @@ -344,6 +354,12 @@ namespace MonoDevelop.MacDev.XcodeSyncing XC4Debug.Log ("Closing file {0}: {1}", fileName, success); return success; } + + const string XCODE_OPEN_PROJECT = +@"tell application ""{0}"" + activate + open ""{1}"" +end tell"; const string XCODE_OPEN_PROJECT_FILE = @"tell application ""{0}"" diff --git a/main/src/addins/MonoDevelop.MacDev/XcodeSyncing/XcodeProjectTracker.cs b/main/src/addins/MonoDevelop.MacDev/XcodeSyncing/XcodeProjectTracker.cs index 02c06f5294..2592587be4 100644 --- a/main/src/addins/MonoDevelop.MacDev/XcodeSyncing/XcodeProjectTracker.cs +++ b/main/src/addins/MonoDevelop.MacDev/XcodeSyncing/XcodeProjectTracker.cs @@ -249,7 +249,6 @@ namespace MonoDevelop.MacDev.XcodeSyncing continue; if (finf.ProjectFile.BuildAction == BuildAction.Compile) { updateTypes = true; - break; } else if (IncludeInSyncedProject (finf.ProjectFile)) { updateProject = true; } @@ -259,7 +258,7 @@ namespace MonoDevelop.MacDev.XcodeSyncing using (var monitor = GetStatusMonitor (GettextCatalog.GetString ("Syncing to Xcode..."))) { //FIXME: make this async (and safely async) //FIXME: only update the project if obj-c types change - updateProject = UpdateTypes (monitor, true); + updateProject |= UpdateTypes (monitor, true); } } diff --git a/main/src/addins/MonoDevelop.MacDev/XcodeSyncing/XcodeSyncContext.cs b/main/src/addins/MonoDevelop.MacDev/XcodeSyncing/XcodeSyncContext.cs index a39fe1227c..6303d0457c 100644 --- a/main/src/addins/MonoDevelop.MacDev/XcodeSyncing/XcodeSyncContext.cs +++ b/main/src/addins/MonoDevelop.MacDev/XcodeSyncing/XcodeSyncContext.cs @@ -47,7 +47,7 @@ namespace MonoDevelop.MacDev.XcodeSyncing this.syncTimes = syncTimes; } - public FilePath ProjectDir { get; private set; } + public FilePath ProjectDir { get; set; } public DateTime GetSyncTime (string relativeFilename) { |