Matthew,

I don't think its a good idea to change this back to the old behaviour, as
the new behaviour allows access to files in both the working directory, and
the base directory of the project.

Gert

----- Original Message -----
From: "Matthew Mastracci" <[EMAIL PROTECTED]>
To: "Nant-Developers (E-mail)" <[EMAIL PROTECTED]>
Sent: Tuesday, July 06, 2004 5:57 PM
Subject: [nant-dev] Projects and current working directory


> Something that changed in the last six months or so (perhaps longer?) is
> that the projects no longer set their working directory equal to the
> base directory of the project itself.
>
> I'm proposing the following patch to Project.cs to fix this.  Since I
> don't know if anyone relies on the current, strange behaviour, I'm
> posting this here for discussion.
>
> I know that Project.GetFullPath() is supposed to handle this stuff, but
> I believe there might be a few cases within NAnt where it isn't handled
> properly (ie: paths are taken literally, rather than using
> Project.GetFullPath).  I know my <solution> compiles take longer with
> this disabled, but I haven't yet determined what the problem is.
>
> --- Project.cs 24 May 2004 18:03:38 -0000 1.71
> +++ Project.cs 5 Jul 2004 22:36:36 -0000
> @@ -882,8 +882,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);
>
> @@ -917,6 +921,9 @@
>                   // signal build failure
>                   return false;
>               } finally {
> +                // restore the old directory
> +                Directory.SetCurrentDirectory(oldDirectory);
> +
>                   string endTarget;
>
>                   if (error == null) {
>
>
>
> -------------------------------------------------------
> This SF.Net email sponsored by Black Hat Briefings & Training.
> Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
> digital self defense, top technical experts, no vendor pitches,
> unmatched networking opportunities. Visit www.blackhat.com
> _______________________________________________
> nant-developers mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/nant-developers
>



-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
nant-developers mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nant-developers

Reply via email to