[Unison-hackers] [unison-svn] r463 - in trunk/src: . uimacnew/uimacnew.xcodeproj uimacnew09 uimacnew09/uimacnew.xcodeproj

schmitta at seas.upenn.edu schmitta at seas.upenn.edu
Mon Sep 6 12:37:04 EDT 2010


Author: schmitta
Date: 2010-09-06 12:37:04 -0400 (Mon, 06 Sep 2010)
New Revision: 463

Modified:
   trunk/src/uimacbridgenew.ml
   trunk/src/uimacnew/uimacnew.xcodeproj/project.pbxproj
   trunk/src/uimacnew09/MyController.m
   trunk/src/uimacnew09/uimacnew.xcodeproj/project.pbxproj
Log:
the OS X command line tool is now able to take roots on the command line when no profile is specified. This change has only been implemented in uimacnew09.



Modified: trunk/src/uimacbridgenew.ml
===================================================================
--- trunk/src/uimacbridgenew.ml	2010-07-24 14:07:55 UTC (rev 462)
+++ trunk/src/uimacbridgenew.ml	2010-09-06 16:37:04 UTC (rev 463)
@@ -187,29 +187,43 @@
 ;;
 Callback.register "unisonInit0" unisonInit0;;
 
+(* Utility function to tell the UI whether roots were set *)
+
+let areRootsSet () = 
+  match Globals.rawRoots() with
+  | [] -> false
+  | _ -> true
+;;
+Callback.register "areRootsSet" areRootsSet;;
+
+
 (* The first time we load preferences, we also read the command line
    arguments; if we re-load prefs (because the user selected a new profile)
    we ignore the command line *)
 let firstTime = ref(true)
 
-(* After figuring out the profile name *)
+(* After figuring out the profile name. If the profileName is the empty
+   string, it means that only the roots were specified on the command
+   line *)
 let do_unisonInit1 profileName =
   (* Load the profile and command-line arguments *)
   (* Restore prefs to their default values, if necessary *)
   if not !firstTime then Prefs.resetToDefaults();
 
-  (* Tell the preferences module the name of the profile *)
-  Prefs.profileName := Some(profileName);
+  if profileName <> "" then begin
+    (* Tell the preferences module the name of the profile *)
+    Prefs.profileName := Some(profileName);
   
-  (* If the profile does not exist, create an empty one (this should only
-     happen if the profile is 'default', since otherwise we will already
-     have checked that the named one exists). *)
-   if not(System.file_exists (Prefs.profilePathname profileName)) then
-     Prefs.addComment "Unison preferences file";
+    (* If the profile does not exist, create an empty one (this should only
+       happen if the profile is 'default', since otherwise we will already
+       have checked that the named one exists). *)
+    if not(System.file_exists (Prefs.profilePathname profileName)) then
+      Prefs.addComment "Unison preferences file";
 
-  (* Load the profile *)
-  (Trace.debug "" (fun() -> Util.msg "about to load prefs");
-  Prefs.loadTheFile());
+    (* Load the profile *)
+    (Trace.debug "" (fun() -> Util.msg "about to load prefs");
+    Prefs.loadTheFile())
+  end;
 
   (* Parse the command line.  This will temporarily override
      settings from the profile. *)

Modified: trunk/src/uimacnew/uimacnew.xcodeproj/project.pbxproj
===================================================================
--- trunk/src/uimacnew/uimacnew.xcodeproj/project.pbxproj	2010-07-24 14:07:55 UTC (rev 462)
+++ trunk/src/uimacnew/uimacnew.xcodeproj/project.pbxproj	2010-09-06 16:37:04 UTC (rev 463)
@@ -560,6 +560,8 @@
 		2A3C3F290992245300E404E9 /* Development */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_64_BIT_PRE_XCODE_3_1 = x86_64;
 				COPY_PHASE_STRIP = NO;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(FRAMEWORK_SEARCH_PATHS)",
@@ -586,6 +588,7 @@
 				);
 				PREBINDING = NO;
 				PRODUCT_NAME = Unison;
+				SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.6.sdk";
 				SECTORDER_FLAGS = "";
 				WARNING_CFLAGS = (
 					"-Wmost",
@@ -600,6 +603,8 @@
 		2A3C3F2A0992245300E404E9 /* Deployment */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_64_BIT_PRE_XCODE_3_1 = x86_64;
 				COPY_PHASE_STRIP = YES;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(FRAMEWORK_SEARCH_PATHS)",
@@ -623,6 +628,7 @@
 				);
 				PREBINDING = NO;
 				PRODUCT_NAME = Unison;
+				SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.6.sdk";
 				SECTORDER_FLAGS = "";
 				WARNING_CFLAGS = (
 					"-Wmost",
@@ -637,6 +643,8 @@
 		2A3C3F2B0992245300E404E9 /* Default */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_64_BIT_PRE_XCODE_3_1)";
+				ARCHS_STANDARD_64_BIT_PRE_XCODE_3_1 = x86_64;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(FRAMEWORK_SEARCH_PATHS)",
 					"$(SRCROOT)",
@@ -657,6 +665,7 @@
 				);
 				PREBINDING = NO;
 				PRODUCT_NAME = Unison;
+				SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.6.sdk";
 				SECTORDER_FLAGS = "";
 				WARNING_CFLAGS = (
 					"-Wmost",

Modified: trunk/src/uimacnew09/MyController.m
===================================================================
--- trunk/src/uimacnew09/MyController.m	2010-07-24 14:07:55 UTC (rev 462)
+++ trunk/src/uimacnew09/MyController.m	2010-09-06 16:37:04 UTC (rev 463)
@@ -108,7 +108,15 @@
   [versionText setStringValue:ocamlCall("S", "unisonGetVersion")];
   
   /* Command-line processing */
-  OCamlValue *clprofile = (id)ocamlCall("@", "unisonInit0");
+	OCamlValue *clprofile = (id)ocamlCall("@", "unisonInit0");
+	BOOL areRootsSet = (long)ocamlCall("i@", "areRootsSet") ? YES : NO;
+	if (areRootsSet) {
+		NSLog(@"Roots are on the command line");
+	}
+	else {
+		NSLog(@"Roots are not set on the command line");
+	}
+
   
   /* Add toolbar */
   toolbar = [[[UnisonToolbar alloc] 
@@ -130,6 +138,12 @@
     /* Start the connection */
     [self connect:profileName];
   }
+  else if (areRootsSet) {
+	/* If invoked from terminal we need to bring the app to the front */
+	[NSApp activateIgnoringOtherApps:YES];
+	/* Start the connection with the empty profile name, indicating roots only */
+	[self connect:@""];
+  }
   else {
     /* If invoked from terminal we need to bring the app to the front */
     [NSApp activateIgnoringOtherApps:YES];

Modified: trunk/src/uimacnew09/uimacnew.xcodeproj/project.pbxproj
===================================================================
--- trunk/src/uimacnew09/uimacnew.xcodeproj/project.pbxproj	2010-07-24 14:07:55 UTC (rev 462)
+++ trunk/src/uimacnew09/uimacnew.xcodeproj/project.pbxproj	2010-09-06 16:37:04 UTC (rev 463)
@@ -576,6 +576,7 @@
 		2A3C3F290992245300E404E9 /* Development */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_64_BIT)";
 				COPY_PHASE_STRIP = NO;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(FRAMEWORK_SEARCH_PATHS)",
@@ -619,6 +620,7 @@
 		2A3C3F2A0992245300E404E9 /* Deployment */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_64_BIT)";
 				COPY_PHASE_STRIP = YES;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(FRAMEWORK_SEARCH_PATHS)",
@@ -659,6 +661,7 @@
 		2A3C3F2B0992245300E404E9 /* Default */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
+				ARCHS = "$(ARCHS_STANDARD_64_BIT)";
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(FRAMEWORK_SEARCH_PATHS)",
 					"$(SRCROOT)",



More information about the Unison-hackers mailing list