Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnkit Jain <radical@corewars.org>2007-02-01 14:48:39 +0300
committerAnkit Jain <radical@corewars.org>2007-02-01 14:48:39 +0300
commit468f7682628252ec138c7a4e067075689c9bd3b2 (patch)
tree5e35326634902e8d4181c6311283f5621a1e43de /Extras/prj2make-sharp-lib
parent2b56b032f4c02de041951e6c3c11195195ec1d90 (diff)
* MSBuildFileFormat.cs (ReadItemGroups): Check for invalid paths.
(GetValidPath): New. svn path=/trunk/monodevelop/; revision=72084
Diffstat (limited to 'Extras/prj2make-sharp-lib')
-rw-r--r--Extras/prj2make-sharp-lib/ChangeLog5
-rw-r--r--Extras/prj2make-sharp-lib/MSBuildFileFormat.cs51
2 files changed, 48 insertions, 8 deletions
diff --git a/Extras/prj2make-sharp-lib/ChangeLog b/Extras/prj2make-sharp-lib/ChangeLog
index 78674f9e96..03527708e5 100644
--- a/Extras/prj2make-sharp-lib/ChangeLog
+++ b/Extras/prj2make-sharp-lib/ChangeLog
@@ -1,3 +1,8 @@
+2007-02-01 Ankit Jain <jankit@novell.com>
+
+ * MSBuildFileFormat.cs (ReadItemGroups): Check for invalid paths.
+ (GetValidPath): New.
+
2007-01-27 Ankit Jain <jankit@novell.com>
* MSBuildFileFormat.cs (ReferenceToXmlElement): Use System.Reflection to
diff --git a/Extras/prj2make-sharp-lib/MSBuildFileFormat.cs b/Extras/prj2make-sharp-lib/MSBuildFileFormat.cs
index c527df23ae..cce107de42 100644
--- a/Extras/prj2make-sharp-lib/MSBuildFileFormat.cs
+++ b/Extras/prj2make-sharp-lib/MSBuildFileFormat.cs
@@ -782,6 +782,7 @@ namespace MonoDevelop.Prj2Make
continue;
}
+ string path = null;
string include = node.Attributes ["Include"].Value;
pf = null;
pr = null;
@@ -804,7 +805,19 @@ namespace MonoDevelop.Prj2Make
project.ProjectReferences.Add (pr);
} else {
//Not in the Gac, has HintPath
- pr = project.AddReference (MapAndResolvePath (basePath, hintPath));
+ path = MapAndResolvePath (basePath, hintPath);
+ if (path == null) {
+ Console.WriteLine (GettextCatalog.GetString (
+ "HintPath ({0}) for Reference '{1}' is invalid. Ignoring.",
+ hintPath, include));
+ monitor.ReportWarning (GettextCatalog.GetString (
+ "HintPath ({0}) for Reference '{1}' is invalid. Ignoring.",
+ hintPath, include));
+
+ continue;
+ }
+
+ pr = project.AddReference (path);
}
data.ProjectReferenceElements [pr] = (XmlElement) node;
@@ -831,27 +844,39 @@ namespace MonoDevelop.Prj2Make
break;
case "Compile":
- pf = project.AddFile (MapAndResolvePath (basePath, include), BuildAction.Compile);
+ path = GetValidPath (monitor, basePath, include);
+ if (path == null)
+ continue;
+ pf = project.AddFile (path, BuildAction.Compile);
data.ProjectFileElements [pf] = (XmlElement) node;
break;
case "None":
- pf = project.AddFile (MapAndResolvePath (basePath, include), BuildAction.Nothing);
+ path = GetValidPath (monitor, basePath, include);
+ if (path == null)
+ continue;
+ pf = project.AddFile (path, BuildAction.Nothing);
data.ProjectFileElements [pf] = (XmlElement) node;
break;
case "Content":
- pf = project.AddFile (MapAndResolvePath (basePath, include), BuildAction.FileCopy);
+ path = GetValidPath (monitor, basePath, include);
+ if (path == null)
+ continue;
+ pf = project.AddFile (path, BuildAction.FileCopy);
data.ProjectFileElements [pf] = (XmlElement) node;
break;
case "EmbeddedResource":
- string fname = MapAndResolvePath (basePath, include);
- if (!fname.StartsWith (project.BaseDirectory)) {
+ path = GetValidPath (monitor, basePath, include);
+ if (path == null)
+ continue;
+
+ if (!path.StartsWith (project.BaseDirectory)) {
monitor.ReportWarning (GettextCatalog.GetString (
"The specified path '{0}' for the EmbeddedResource is outside the project directory. Ignoring.", include));
Console.WriteLine ("The specified path '{0}' for the EmbeddedResource is outside the project directory. Ignoring.", include);
continue;
}
- pf = project.AddFile (fname, BuildAction.EmbedAsResource);
+ pf = project.AddFile (path, BuildAction.EmbedAsResource);
if (ReadAsString (node, "LogicalName", ref str_tmp, false))
pf.ResourceId = str_tmp;
data.ProjectFileElements [pf] = (XmlElement) node;
@@ -887,6 +912,17 @@ namespace MonoDevelop.Prj2Make
}
}
+ string GetValidPath (IProgressMonitor monitor, string basePath, string relPath)
+ {
+ string path = MapAndResolvePath (basePath, relPath);
+ if (path != null)
+ return path;
+
+ Console.WriteLine (GettextCatalog.GetString ("File name '{0}' is invalid. Ignoring.", relPath));
+ monitor.ReportWarning (GettextCatalog.GetString ("File name '{0}' is invalid. Ignoring.", relPath));
+ return null;
+ }
+
//FIXME: Too many params ?
void ReadConfig (XPathNavigator nav, DotNetProjectConfiguration config,
string lang, string basePath, ref string default_config, ref string default_platform)
@@ -922,7 +958,6 @@ namespace MonoDevelop.Prj2Make
config.OutputAssembly = str_tmp;
if (ReadAsString (nav, "OutputPath", ref str_tmp, false))
- //FIXME: default path ?
config.OutputDirectory = MapAndResolvePath (basePath, str_tmp);
if (ReadAsBool (nav, "DebugSymbols", ref bool_tmp))