[Monodevelop-patches-list] r1882 - trunk/MonoDevelop/Core/src/Main/StartUp

commit-watcher at mono-cvs.ximian.com commit-watcher at mono-cvs.ximian.com
Fri Jul 2 00:30:49 EDT 2004


Author: jluke
Date: 2004-07-02 00:30:49 -0400 (Fri, 02 Jul 2004)
New Revision: 1882

Modified:
   trunk/MonoDevelop/Core/src/Main/StartUp/ChangeLog
   trunk/MonoDevelop/Core/src/Main/StartUp/MonoDevelopMain.cs
   trunk/MonoDevelop/Core/src/Main/StartUp/MonoDevelopOptions.cs
Log:
2004-07-01  John Luke  <jluke at cfl.rr.com>
 
        * MonoDevelopMain.cs: return 1 on error and 0 otherwise
        * MonoDevelopOptions.cs: remove unneeded -f option
        implement reusing MD instance only when we are getting passed
        arguments (like files). This allows more than one MD to be run
        at a time, and adding files from nautilus still works.  Less
        than perfect, but better than what it was



Modified: trunk/MonoDevelop/Core/src/Main/StartUp/ChangeLog
===================================================================
--- trunk/MonoDevelop/Core/src/Main/StartUp/ChangeLog	2004-07-02 03:05:52 UTC (rev 1881)
+++ trunk/MonoDevelop/Core/src/Main/StartUp/ChangeLog	2004-07-02 04:30:49 UTC (rev 1882)
@@ -1,5 +1,14 @@
 2004-07-01  John Luke  <jluke at cfl.rr.com>
 
+	* MonoDevelopMain.cs: return 1 on error and 0 otherwise
+	* MonoDevelopOptions.cs: remove unneeded -f option
+	implement reusing MD instance only when we are getting passed
+	arguments (like files). This allows more than one MD to be run
+	at a time, and adding files from nautilus still works.  Less
+	than perfect, but better than what it was
+
+2004-07-01  John Luke  <jluke at cfl.rr.com>
+
 	* MonoDevelopMain.cs: implement nologo
 	* MonoDevelopOptions.cs: add -f and --nologo args
 

Modified: trunk/MonoDevelop/Core/src/Main/StartUp/MonoDevelopMain.cs
===================================================================
--- trunk/MonoDevelop/Core/src/Main/StartUp/MonoDevelopMain.cs	2004-07-02 03:05:52 UTC (rev 1881)
+++ trunk/MonoDevelop/Core/src/Main/StartUp/MonoDevelopMain.cs	2004-07-02 04:30:49 UTC (rev 1882)
@@ -57,7 +57,7 @@
 		/// <summary>
 		/// Starts the core of MonoDevelop.
 		/// </summary>
-		public static void Main (string[] args)
+		public static int Main (string[] args)
 		{
 			MonoDevelopOptions options = new MonoDevelopOptions ();
 			options.ProcessArgs (args);
@@ -67,15 +67,22 @@
 			listen_socket = new Socket (AddressFamily.Unix, SocketType.Stream, ProtocolType.IP);
 			EndPoint ep = new UnixEndPoint (socket_filename);
 
-			if (File.Exists (socket_filename)) {
-				try {
+			// only reuse if we are being passed in a file
+			if (remainingArgs.Length > 0 && File.Exists (socket_filename))
+			{
+				try
+				{
 					listen_socket.Connect (ep);
 					listen_socket.Send (Encoding.UTF8.GetBytes (String.Join ("\n", remainingArgs)));
-					return;
-				} catch {
+					return 0;
 				}
+				catch
+				{
+				}
 			}
-			File.Delete (socket_filename);
+
+			// why was this here
+			// File.Delete (socket_filename);
 			
 			string name = Assembly.GetEntryAssembly ().GetName ().Name;
 			string version = Assembly.GetEntryAssembly ().GetName ().Version.Major + + "." + Assembly.GetEntryAssembly ().GetName ().Version.Minor;
@@ -116,20 +123,30 @@
 
 			} catch (XmlException e) {
 				Console.WriteLine("Could not load XML :\n" + e.Message);
-				return;
+				return 1;
 			} catch (Exception e) {
 				Console.WriteLine("Loading error, please reinstall :\n" + e.ToString());
-				return;
+				return 1;
 			} finally {
 				if (SplashScreenForm.SplashScreen != null) {
 					SplashScreenForm.SplashScreen.Hide();
 				}
 			}
 
+			// FIXME: we should probably track the last 'selected' one
+			// and do this more cleanly
+			try
+			{
+				listen_socket.Bind (ep);
+				listen_socket.Listen (5);
+				listen_socket.BeginAccept (new AsyncCallback (ListenCallback), listen_socket);
+			}
+			catch
+			{
+				Console.WriteLine ("Socket already in use");
+			}
+
 			// run the last autostart command, this must be the workbench starting command
-			listen_socket.Bind (ep);
-			listen_socket.Listen (5);
-			listen_socket.BeginAccept (new AsyncCallback (ListenCallback), listen_socket);
 			if (commands.Count > 0) {
 				RunMainLoop ();
 				((ICommand)commands[commands.Count - 1]).Run();
@@ -139,6 +156,7 @@
 			File.Delete (socket_filename);
 			ServiceManager.UnloadAllServices();
 			System.Environment.Exit (0);
+			return 0;
 		}
 
 		static string fileToOpen = String.Empty;

Modified: trunk/MonoDevelop/Core/src/Main/StartUp/MonoDevelopOptions.cs
===================================================================
--- trunk/MonoDevelop/Core/src/Main/StartUp/MonoDevelopOptions.cs	2004-07-02 03:05:52 UTC (rev 1881)
+++ trunk/MonoDevelop/Core/src/Main/StartUp/MonoDevelopOptions.cs	2004-07-02 04:30:49 UTC (rev 1882)
@@ -10,11 +10,6 @@
 			base.ParsingMode = OptionsParsingMode.Both;
 		}
 
-		// FIXME: we really ignore this, but this allows
-		// us to know it is ok to reuse the socket
-		[Option ("Start with this file open.", 'f')]
-		public bool file;
-
 		[Option ("Do not display splash screen.")]
 		public bool nologo;
 	}




More information about the Monodevelop-patches-list mailing list