Mr. Driesen the patch is attached to the message, I hope it is ok.

I'll need to take a better look at building some Unit Tests before sending something concrete.

I guess that my patch code could be improved for performance and programming logic, I'll have a look at that too.

Regards,
Rodrigo

PS: Sorry for the previous e-mail, my email client was misconfigured.

Gert Driesen wrote:
----- Original Message ----- 
From: <[EMAIL PROTECTED]>
To: <nant-developers@lists.sourceforge.net>
Sent: Monday, February 28, 2005 7:38 AM
Subject: [nant-dev] Path Too Long Patch


  

Gentleman, has someone submitted a patch to address the frameworks Path
    
Too
  
Long limitation?
    

Nope, not yet.

  
If not, I have made one and would like to know some guidelines to do some
testing on it (my tests, have been building using the solution task, but
this is highly specific to my case) (I Altered the NAnt.Core.Util
FileUtils.cs and NAnt.VSNet AssemblyReferenceBase.cs so far so good, but
    
it
  
seems that there should be more work on other places where the
Path.GetFullPath is used)
    

It would be great if you could create some unit tests for FileUtils, but
other than that : just send the patch to this list.

We should indeed identify the other tasks that could be affected by this ...

  
BTW, I've never helped in an Open Source Solution before, and would like
    
to
  
start contributing in the right way.....
    

Sending it to the list would be appropriate in this case.

Thanks !

Gert


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
nant-developers mailing list
nant-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-developers

  
Index: C:/nant-0.85-rc2/src/NAnt.Core/Util/FileUtils.cs
===================================================================
--- C:/nant-0.85-rc2/src/NAnt.Core/Util/FileUtils.cs    (revision 28)
+++ C:/nant-0.85-rc2/src/NAnt.Core/Util/FileUtils.cs    (working copy)
@@ -139,5 +139,40 @@
             // return the 
             return new DirectoryInfo(tempFile);
         }
+
+                    /// <summary>
+                    /// Returns Absolute Path (Fix for 260 Char Limit of 
Path.GetFullPath(...))
+                    /// </summary>
+                    /// <param name="PathName">The Path to Resolve</param>
+                    /// <returns>Path Resolved</returns>
+                    public static string AbsPath(String PathName)
+                    {
+                          // Let's Setup Regex options  
+                          System.Text.RegularExpressions.RegexOptions 
reOptions = 
((System.Text.RegularExpressions.RegexOptions.IgnorePatternWhitespace | 
System.Text.RegularExpressions.RegexOptions.Multiline) | 
System.Text.RegularExpressions.RegexOptions.IgnoreCase);
+                          System.Text.RegularExpressions.Regex regEx = new 
System.Text.RegularExpressions.Regex(@"\\", reOptions);
+            
+                          // Now we split the Path by the Path Separator
+                          String[] items = regEx.Split(PathName);
+                          System.Collections.ArrayList arList = new 
System.Collections.ArrayList();
+            
+                          // For each Item in the path that differs from ".." 
we just add it to the ArrayList
+                          for( int iCount = 0; iCount < items.Length; iCount++ 
)
+                          {
+                              // If we get a ".." Try to remove the last item 
added (as if going up in the Directory Structure)
+                              if( items[iCount] == ".." )
+                              {
+                                  if( arList.Count > 0 )
+                                  {
+                                      arList.RemoveAt(arList.Count-1);
+                                  }
+                              }
+                              else
+                                  arList.Add(items[iCount]);
+                          }
+            
+                          // Join everything using the Path Separator
+                          return String.Join(@"\", 
(String[])arList.ToArray(typeof(String)));
+                    }
+                    
     }
 }
Index: C:/nant-0.85-rc2/src/NAnt.VSNet/AssemblyReferenceBase.cs
===================================================================
--- C:/nant-0.85-rc2/src/NAnt.VSNet/AssemblyReferenceBase.cs    (revision 28)
+++ C:/nant-0.85-rc2/src/NAnt.VSNet/AssemblyReferenceBase.cs    (working copy)
@@ -240,7 +240,7 @@
                     relativePath);
 
                 try {
-                    return Path.GetFullPath(combinedPath);
+                    return FileUtils.AbsPath(combinedPath);
                 } catch (PathTooLongException ex) {
                     throw new 
BuildException(string.Format(CultureInfo.InvariantCulture,
                         "Assembly \"{0}\", referenced by project \"{1}\", 
could not be"

Reply via email to