[Mono-list] Moma Reports dir

Jonathan Pobst monkey at jpobst.com
Fri Mar 30 09:52:39 EDT 2007


Hey Phillip!

This patch also uses the user's directory for the images and definition 
files.  I think those truly are global, and each user shouldn't have 
their own copy of them.  They should remain with the executable.

As for the reports, I'm not really sure how much of a difference there 
is.  If MoMA stored all the reports ever made, I think it would make 
sense to store them in the user's directory.  However, since it only 
stores the most recent report, its really more of a temporary directory 
than user storage of reports.  Since the user (in theory) doesn't access 
the report directly from the file system, it doesn't really matter where 
it is.

The other issue with making changes to MoMA is that I don't really 
release new versions of it.  Due to the definition update built-in to 
MoMA, no one needs to download a new version of MoMA, so they won't get 
any changes made.  When a new version of Mono is released, I do release 
a new MoMA that may include some small fixes and new definition files, 
but it is never announced for people to upgrade unless they are hitting 
bugs.

Having said all that, if people strongly feel reports should be stored 
in the user's directory, I'm not against it and can make the change.

Jon


Phillip N. wrote:
> Hi mono's..
> 
> Is it possible to make MoMa use the user's dir to save/work the Reports?
> 
> thanks!
> 
> 
> 
> 
> ------------------------------------------------------------------------
> 
> Index: DefinitionDownloader.cs
> ===================================================================
> --- DefinitionDownloader.cs	(revision 75003)
> +++ DefinitionDownloader.cs	(working copy)
> @@ -19,7 +19,7 @@
>  		{
>  			InitializeComponent ();
>  
> -			image_directory = Path.Combine (Path.GetDirectoryName (Application.ExecutablePath), "Resources");
> +			image_directory = Path.Combine (Path.GetDirectoryName (Application.LocalUserAppDataPath), "Resources");
>  			LoadImages ();
>  		}
>  
> @@ -44,7 +44,7 @@
>  			Application.DoEvents ();
>  			
>  			try {
> -				string definition_directory = Path.Combine (Path.GetDirectoryName (Application.ExecutablePath), "Definitions");
> +				string definition_directory = Path.Combine (Path.GetDirectoryName (Application.LocalUserAppDataPath), "Definitions");
>  				
>  				if (!Directory.Exists (definition_directory))
>  					Directory.CreateDirectory (definition_directory);
> @@ -100,4 +100,4 @@
>  			}
>  		}
>  	}
> -}
> \ No newline at end of file
> +}
> Index: MainForm.cs
> ===================================================================
> --- MainForm.cs	(revision 75003)
> +++ MainForm.cs	(working copy)
> @@ -25,7 +25,7 @@
>  		{
>  			InitializeComponent ();
>  
> -			image_directory = Path.Combine (Path.GetDirectoryName (Application.ExecutablePath), "Resources");
> +			image_directory = Path.Combine (Path.GetDirectoryName (Application.LocalUserAppDataPath), "Resources");
>  			LoadImages ();
>  			
>  			// Process.Start doesn't work on Unix, so we'll just hide the link
> @@ -217,9 +217,9 @@
>  			int pinvokecount = 0;
>  			int missingcount = 0;
>  
> -			string todo_defs = Path.Combine (Path.GetDirectoryName (Application.ExecutablePath), "monotodo.txt");
> -			string nie_defs = Path.Combine (Path.GetDirectoryName (Application.ExecutablePath), "exception.txt");
> -			string missing_defs = Path.Combine (Path.GetDirectoryName (Application.ExecutablePath), "missing.txt");
> +			string todo_defs = Path.Combine (Path.GetDirectoryName (Application.LocalUserAppDataPath), "monotodo.txt");
> +			string nie_defs = Path.Combine (Path.GetDirectoryName (Application.LocalUserAppDataPath), "exception.txt");
> +			string missing_defs = Path.Combine (Path.GetDirectoryName (Application.LocalUserAppDataPath), "missing.txt");
>  
>  			// Load the definition files
>  			FileDefinition definitions = (FileDefinition)MonoVersionCombo.SelectedItem;
> @@ -234,10 +234,10 @@
>  				aa.ScanAssemblyForPInvokes ((string)lvi.Tag);
>  
>  			// Start the results reports
> -			if (!Directory.Exists (Path.Combine (Path.GetDirectoryName (Application.ExecutablePath), "Reports")))
> -				Directory.CreateDirectory (Path.Combine (Path.GetDirectoryName (Application.ExecutablePath), "Reports"));
> +			if (!Directory.Exists (Path.Combine (Path.GetDirectoryName (Application.LocalUserAppDataPath), "Reports")))
> +				Directory.CreateDirectory (Path.Combine (Path.GetDirectoryName (Application.LocalUserAppDataPath), "Reports"));
>  
> -			string output_path = Path.Combine (Path.GetDirectoryName (Application.ExecutablePath), "Reports");
> +			string output_path = Path.Combine (Path.GetDirectoryName (Application.LocalUserAppDataPath), "Reports");
>  			XhtmlTextWriter report = aa.BeginHtmlReport (new FileStream (Path.Combine (output_path, "output.html"), FileMode.Create));
>  			StreamWriter submit_report = aa.BeginTextReport (new FileStream (Path.Combine (output_path, "submit.txt"), FileMode.Create));
>  
> @@ -326,7 +326,7 @@
>  
>  		private void ResultsDetailLink_LinkClicked (object sender, LinkLabelLinkClickedEventArgs e)
>  		{
> -			string report_file = Path.Combine (Path.Combine (Path.GetDirectoryName (Application.ExecutablePath), "Reports"), "output.html");
> +			string report_file = Path.Combine (Path.Combine (Path.GetDirectoryName (Application.LocalUserAppDataPath), "Reports"), "output.html");
>  
>  			try {
>  				System.Diagnostics.Process.Start (report_file);
> @@ -343,7 +343,7 @@
>  
>  		private void ViewReportButton_Click (object sender, EventArgs e)
>  		{
> -			string report_file = Path.Combine (Path.Combine (Path.GetDirectoryName (Application.ExecutablePath), "Reports"), "submit.txt");
> +			string report_file = Path.Combine (Path.Combine (Path.GetDirectoryName (Application.LocalUserAppDataPath), "Reports"), "submit.txt");
>  			
>  			try {	        
>  				System.Diagnostics.Process.Start (report_file);	
> @@ -356,7 +356,7 @@
>  		private void SubmitReportButton_Click (object sender, EventArgs e)
>  		{
>  			SubmitReportButton.Enabled = false;
> -			string output_path = Path.Combine (Path.GetDirectoryName (Application.ExecutablePath), "Reports");
> +			string output_path = Path.Combine (Path.GetDirectoryName (Application.LocalUserAppDataPath), "Reports");
>  			string file = Path.Combine (output_path, "submit.txt");
>  
>  			try {
> @@ -397,7 +397,7 @@
>  		{
>  			MonoVersionCombo.Items.Clear ();
>  			
> -			foreach (FileDefinition fd in DefinitionHandler.FindAvailableVersions (Path.Combine (Path.GetDirectoryName (Application.ExecutablePath), "Definitions")))
> +			foreach (FileDefinition fd in DefinitionHandler.FindAvailableVersions (Path.Combine (Path.GetDirectoryName (Application.LocalUserAppDataPath), "Definitions")))
>  				MonoVersionCombo.Items.Add (fd);
>  
>  			if (MonoVersionCombo.Items.Count > 0)
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list



More information about the Mono-list mailing list