[MonoDevelop] [Patch] Check if basedir exists before saving properties
Christian Hergert
christian.hergert at gmail.com
Tue Sep 4 02:17:34 EDT 2007
If a user `rm -rf ~/.config/MonoDevelop/` and then tries to run monodevelop
again with `make run`, an exception will be thrown when attempting to save
the properties xml. I'm not sure if the PropertyService is the proper place
to check, perhaps the Properties class itself. Anywho, to get the ball
rolling ..
Index: Core/src/MonoDevelop.Core/MonoDevelop.Core/PropertyService.cs
===================================================================
--- Core/src/MonoDevelop.Core/MonoDevelop.Core/PropertyService.cs
(revision 85252)
+++ Core/src/MonoDevelop.Core/MonoDevelop.Core/PropertyService.cs
(working copy)
@@ -88,7 +88,14 @@
public static void SaveProperties()
{
Debug.Assert (properties != null);
- properties.Save (Path.Combine (ConfigPath,
FileName));
+
+ string filePath = Path.Combine (ConfigPath,
FileName);
+ string dirPath = Path.GetDirectoryName (filePath);
+
+ if (!Directory.Exists (dirPath))
+ Directory.CreateDirectory (dirPath);
+
+ properties.Save (filePath);
}
public static T Get<T> (string property, T defaultValue)
-- Christian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/monodevelop-list/attachments/20070903/c368a88d/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: md-crash-properties.patch
Type: text/x-patch
Size: 762 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/monodevelop-list/attachments/20070903/c368a88d/attachment.bin
More information about the Monodevelop-list
mailing list