[MonoDevelop] Latest patch breaks MD

Rubens Ramos rubensr@users.sourceforge.net
Wed, 01 Dec 2004 23:17:39 +1030


--=-UtTrvM6WVwzS6lB7IGXE
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Here is a patch that will add a link to the default
project path, and if that does not exist, to the
user's HOME directory (only if one of them exist).

This uses Environment.GetEnvironmentVariable ("HOME"),
but people may want to use 
Environment.SpecialFolder.Personal
instead, not sure what the standard way of doing this is
in MD.

Cheers
Rubens

On Wed, 2004-12-01 at 22:58, J. Christopher Six wrote:
> The patch submitted earlier adding ~/Projects to the new
> FileSelector's bookmarks causes MD to crash when you try to open a
> file and no ~/Projects folder exists. It also makes a faulty
> assumption that all users name their project directory "Projects".
>  
> -- J. Christopher Six
> _______________________________________________
> Monodevelop-list mailing list
> Monodevelop-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/monodevelop-list

--=-UtTrvM6WVwzS6lB7IGXE
Content-Disposition: attachment; filename=patch.diff
Content-Type: text/x-patch; name=patch.diff; charset=UTF-8
Content-Transfer-Encoding: 7bit

Index: Core/src/Libraries/MonoDevelop.Gui.Widgets/FileSelector/FileSelector.cs
===================================================================
--- Core/src/Libraries/MonoDevelop.Gui.Widgets/FileSelector/FileSelector.cs	(revision 2041)
+++ Core/src/Libraries/MonoDevelop.Gui.Widgets/FileSelector/FileSelector.cs	(working copy)
@@ -10,6 +10,7 @@
 	{
 		const string LastPathProperty = "MonoDevelop.FileSelector.LastPath";
 		PropertyService propertyService = (PropertyService) ServiceManager.GetService (typeof (PropertyService));
+		FileUtilityService  fileUtilityService = (FileUtilityService)ServiceManager.GetService(typeof(FileUtilityService));
 
 		public FileSelector () : base (GettextCatalog.GetString ("Open file ..."), null, FileChooserAction.Open)
 		{
@@ -52,9 +53,13 @@
 			else
 				this.SetCurrentFolder (Environment.GetFolderPath (Environment.SpecialFolder.Personal));
 
-			// add ~/Projects as a MD bookmark
-			this.AddShortcutFolder (System.IO.Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.Personal), "Projects"));
+			// add default project path as a MD bookmark
+			string pathName = propertyService.GetProperty ("MonoDevelop.Gui.Dialogs.NewProjectDialog.DefaultPath", fileUtilityService.GetDirectoryNameWithSeparator (Environment.GetEnvironmentVariable ("HOME"))).ToString();
 
+			if (fileUtilityService.IsDirectory(pathName)) {
+				this.AddShortcutFolder (pathName);
+			}
+
 			// FIXME: only set this once per-dialog
 			// perhaps in Dispose ()? or only when a file or dir is selected
 			this.CurrentFolderChanged += OnCurrentFolderChanged;

--=-UtTrvM6WVwzS6lB7IGXE--