[Monodevelop-patches-list] r2435 - trunk/MonoDevelop/Extras/MonoDeveloperExtensions
Lluis Sanchez <lluis@ximian.com>
lluis at mono-cvs.ximian.com
Wed Apr 6 20:09:39 EDT 2005
Author: lluis
Date: 2005-04-06 20:09:39 -0400 (Wed, 06 Apr 2005)
New Revision: 2435
Modified:
trunk/MonoDevelop/Extras/MonoDeveloperExtensions/ChangeLog
trunk/MonoDevelop/Extras/MonoDeveloperExtensions/MonoProject.cs
Log:
2005-05-07 Lluis Sanchez Gual <lluis at novell.com>
* MonoProject.cs: Update the sources file when files are renamed.
Don't add the ChangeLog file to the project for now, it's too slow
to look for it.
Modified: trunk/MonoDevelop/Extras/MonoDeveloperExtensions/ChangeLog
===================================================================
--- trunk/MonoDevelop/Extras/MonoDeveloperExtensions/ChangeLog 2005-04-07 00:08:56 UTC (rev 2434)
+++ trunk/MonoDevelop/Extras/MonoDeveloperExtensions/ChangeLog 2005-04-07 00:09:39 UTC (rev 2435)
@@ -1,3 +1,9 @@
+2005-05-07 Lluis Sanchez Gual <lluis at novell.com>
+
+ * MonoProject.cs: Update the sources file when files are renamed.
+ Don't add the ChangeLog file to the project for now, it's too slow
+ to look for it.
+
2005-02-12 Lluis Sanchez Gual <lluis at novell.com>
* MonoProject.cs: Don't try to parse errors from the stdout, only
Modified: trunk/MonoDevelop/Extras/MonoDeveloperExtensions/MonoProject.cs
===================================================================
--- trunk/MonoDevelop/Extras/MonoDeveloperExtensions/MonoProject.cs 2005-04-07 00:08:56 UTC (rev 2434)
+++ trunk/MonoDevelop/Extras/MonoDeveloperExtensions/MonoProject.cs 2005-04-07 00:09:39 UTC (rev 2435)
@@ -86,11 +86,11 @@
sr.Close ();
- ArrayList files = new ArrayList ();
+/* ArrayList files = new ArrayList ();
FindFiles (basePath, "ChangeLog", files);
foreach (string file in files)
ProjectFiles.Add (new ProjectFile (file, BuildAction.Exclude));
-
+*/
// Project references
string refs = mkfile.GetVariable ("LIB_MCS_FLAGS");
if (refs == null || refs == "") refs = mkfile.GetVariable ("LOCAL_MCS_FLAGS");
@@ -216,7 +216,35 @@
if (e.ProjectFile.BuildAction != BuildAction.Compile)
return;
+
+ AddSourceFile (e.ProjectFile.Name);
+ }
+
+ protected override void OnFileRemovedFromProject (ProjectFileEventArgs e)
+ {
+ base.OnFileRemovedFromProject (e);
+ if (loading) return;
+
+ if (e.ProjectFile.BuildAction != BuildAction.Compile)
+ return;
+ RemoveSourceFile (e.ProjectFile.Name);
+ }
+
+ protected override void OnFileRenamedInProject (ProjectFileRenamedEventArgs e)
+ {
+ base.OnFileRenamedInProject (e);
+
+ if (loading) return;
+ if (e.ProjectFile.BuildAction != BuildAction.Compile)
+ return;
+
+ if (RemoveSourceFile (e.OldName))
+ AddSourceFile (e.NewName);
+ }
+
+ void AddSourceFile (string sourceFile)
+ {
StreamReader sr = null;
StreamWriter sw = null;
@@ -224,7 +252,7 @@
sr = new StreamReader (outFile + ".sources");
sw = new StreamWriter (outFile + ".sources.new");
- string newFile = GetRelativeChildPath (e.ProjectFile.Name);
+ string newFile = GetRelativeChildPath (sourceFile);
if (newFile.StartsWith ("./")) newFile = newFile.Substring (2);
string line;
@@ -246,22 +274,17 @@
File.Move (outFile + ".sources.new", outFile + ".sources");
}
- protected override void OnFileRemovedFromProject (ProjectFileEventArgs e)
+ bool RemoveSourceFile (string sourceFile)
{
- base.OnFileRemovedFromProject (e);
- if (loading) return;
-
- if (e.ProjectFile.BuildAction != BuildAction.Compile)
- return;
-
StreamReader sr = null;
StreamWriter sw = null;
-
+ bool found = false;
+
try {
sr = new StreamReader (outFile + ".sources");
sw = new StreamWriter (outFile + ".sources.new");
- string oldFile = GetRelativeChildPath (e.ProjectFile.Name);
+ string oldFile = GetRelativeChildPath (sourceFile);
if (oldFile.StartsWith ("./")) oldFile = oldFile.Substring (2);
string line;
@@ -269,13 +292,18 @@
string file = line.Trim (' ','\t');
if (oldFile != file)
sw.WriteLine (line);
+ else
+ found = true;
}
} finally {
if (sr != null) sr.Close ();
if (sw != null) sw.Close ();
}
- File.Delete (outFile + ".sources");
- File.Move (outFile + ".sources.new", outFile + ".sources");
+ if (found) {
+ File.Delete (outFile + ".sources");
+ File.Move (outFile + ".sources.new", outFile + ".sources");
+ }
+ return found;
}
public override void GenerateMakefiles (Combine parentCombine)
More information about the Monodevelop-patches-list
mailing list