Author: miguel
Date: 2007-12-21 12:02:26 -0500 (Fri, 21 Dec 2007)
New Revision: 91774
Modified:
trunk/monodevelop/main/src/addins/prj2make-sharp-lib/ChangeLog
trunk/monodevelop/main/src/addins/prj2make-sharp-lib/MsPrjHelper.cs
trunk/monodevelop/main/src/addins/prj2make-sharp-lib/Utils.cs
Log:
2007-12-21 Miguel de Icaza <[EMAIL PROTECTED]>
* Utils.cs (MapAndResolvePath): this routine only value add was to
call Path.GetFullPath, the problem is that the internals of
SlnMaker.MapPath could be internally broken if not fully formed
internally (in particular when coping with non-existing
directories and files).
* MsPrjHelper.cs (SlnMaker.MapPath): a handful of changes to help
consumers of this class. It now always returns paths that are
Path.GetFullPath processed first. This just makes the code
homogenous.
Uses Directory.GetFileSystemEntries instead of trying to be smart
about Directories and Files and handling them separatedly, as in
Unix symlinks are not accounted for (which breaks if the full path
name contains symlinks).
It now also handles "..", which avoids the bug of OutputPath
entries ending up with "../DIR/../DIR/../DIR" as I reported
privately to Ankit a few days ago.
This should fix the Paint.NET 3 problems.
Modified: trunk/monodevelop/main/src/addins/prj2make-sharp-lib/ChangeLog
===================================================================
--- trunk/monodevelop/main/src/addins/prj2make-sharp-lib/ChangeLog
2007-12-21 16:59:53 UTC (rev 91773)
+++ trunk/monodevelop/main/src/addins/prj2make-sharp-lib/ChangeLog
2007-12-21 17:02:26 UTC (rev 91774)
@@ -1,3 +1,27 @@
+2007-12-21 Miguel de Icaza <[EMAIL PROTECTED]>
+
+ * Utils.cs (MapAndResolvePath): this routine only value add was to
+ call Path.GetFullPath, the problem is that the internals of
+ SlnMaker.MapPath could be internally broken if not fully formed
+ internally (in particular when coping with non-existing
+ directories and files).
+
+ * MsPrjHelper.cs (SlnMaker.MapPath): a handful of changes to help
+ consumers of this class. It now always returns paths that are
+ Path.GetFullPath processed first. This just makes the code
+ homogenous.
+
+ Uses Directory.GetFileSystemEntries instead of trying to be smart
+ about Directories and Files and handling them separatedly, as in
+ Unix symlinks are not accounted for (which breaks if the full path
+ name contains symlinks).
+
+ It now also handles "..", which avoids the bug of OutputPath
+ entries ending up with "../DIR/../DIR/../DIR" as I reported
+ privately to Ankit a few days ago.
+
+ This should fix the Paint.NET 3 problems.
+
2007-12-18 Ankit Jain <[EMAIL PROTECTED]>
Fix bug #349362
Modified: trunk/monodevelop/main/src/addins/prj2make-sharp-lib/MsPrjHelper.cs
===================================================================
--- trunk/monodevelop/main/src/addins/prj2make-sharp-lib/MsPrjHelper.cs
2007-12-21 16:59:53 UTC (rev 91773)
+++ trunk/monodevelop/main/src/addins/prj2make-sharp-lib/MsPrjHelper.cs
2007-12-21 17:02:26 UTC (rev 91774)
@@ -802,8 +802,9 @@
if (basePath != null)
path = Path.Combine (basePath, path);
- if (System.IO.File.Exists (path))
- return path;
+ if (System.IO.File.Exists (path)){
+ return Path.GetFullPath (path);
+ }
if (Path.IsPathRooted (path)) {
@@ -815,11 +816,14 @@
for (int n=0; n<names.Length; n++) {
string[] entries;
- if (n < names.Length - 1)
- entries =
Directory.GetDirectories (part);
- else
- entries = Directory.GetFiles
(part);
+
+ if (names [n] == ".."){
+ part = Path.GetFullPath (part +
"/..");
+ continue;
+ }
+ entries =
Directory.GetFileSystemEntries (part);
+
string fpath = null;
foreach (string e in entries) {
if (string.Compare
(Path.GetFileName (e), names[n], true) == 0) {
@@ -829,16 +833,18 @@
}
if (fpath == null) {
// Part of the path does not
exist. Can't do any more checking.
+ part = Path.GetFullPath (part);
for (; n < names.Length; n++)
part += "/" + names[n];
return part;
}
-
+
part = fpath;
}
- return part;
- } else
- return path;
+ return Path.GetFullPath (part);
+ } else {
+ return Path.GetFullPath (path);
+ }
}
}
}
Modified: trunk/monodevelop/main/src/addins/prj2make-sharp-lib/Utils.cs
===================================================================
--- trunk/monodevelop/main/src/addins/prj2make-sharp-lib/Utils.cs
2007-12-21 16:59:53 UTC (rev 91773)
+++ trunk/monodevelop/main/src/addins/prj2make-sharp-lib/Utils.cs
2007-12-21 17:02:26 UTC (rev 91774)
@@ -234,10 +234,7 @@
public static string MapAndResolvePath (string basePath, string
relPath)
{
- string ret = SlnMaker.MapPath (basePath, relPath);
- if (ret == null)
- return ret;
- return Path.GetFullPath (ret);
+ return SlnMaker.MapPath (basePath, relPath);
}
public static string CanonicalizePath (string path)
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches