So it looks like the recent basedir changes have revealed a long-standing issue w.r.t. assumptions about the current directory. It turns out that there are a few places where the tasks assume that the project's base directory is the same as the current directory. The two big ones I've found are:

1.  The <includeList> element of the <fileset>
2.  The file loaded by <foreach mode="line">

I don't know where else in NAnt these problems might exist. I've worked around it with this simple patch- should it be checked in? The correct solution right now is to wrap all filename references with Project.GetFullPath(), but would it be better to just change our current directory to the project's base directory for the duration of the project run?

--- Project.cs  18 Dec 2003 18:22:33 -0000      1.61
+++ Project.cs  19 Dec 2003 22:06:37 -0000
@@ -784,8 +784,12 @@
         public bool Run() {
             Exception error = null;
             DateTime startTime = DateTime.Now;
+            string oldDirectory = Directory.GetCurrentDirectory();

try {
+ // change to the base directory of the project before running anything
+ Directory.SetCurrentDirectory(BaseDirectory);
+
OnBuildStarted(this, new BuildEventArgs(this));
Log(Level.Info, "Buildfile: {0}", BuildFileUri);


@@ -819,6 +823,9 @@
                 // signal build failure
                 return false;
             } finally {
+                // restore the old directory
+                Directory.SetCurrentDirectory(oldDirectory);
+
                 string endTarget;

if (error == null) {



Matt.


------------------------------------------------------- This SF.net email is sponsored by: IBM Linux Tutorials. Become an expert in LINUX or just sharpen your skills. Sign up for IBM's Free Linux Tutorials. Learn everything from the bash shell to sys admin. Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click _______________________________________________ nant-developers mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/nant-developers

Reply via email to