Aquil,

 

This should work using a recent version of Mono (built from SVN HEAD).

 

Gert

 

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Aquil H.
Abdullah
Sent: woensdag 23 juli 2008 19:48
To: nant-users@lists.sourceforge.net
Subject: [NAnt-users] Removing smbolic links

 

Hello All,
  Sometimes when I execute my clean target it fails because files can't be
deleted. For example, if I have a build file that looks as follows:

<?xml version="1.0"?>
<project name="sym" default="build" basedir=".">
  <target name="build">
    <touch file="foo.so" />
    <exec program="/bin/ln">
      <arg line="-s /home/aha/devel/nant/foo.so foo.so.0" />
    </exec>
  </target>
  <target name="clean">
    <delete file="/home/aha/devel/nant/foo.so" />
    <delete file="/home/aha/devel/nant/foo.so.0" />
  </target>
</project>

And then execute it as follows:

[EMAIL PROTECTED] nant]$ nant
NAnt 0.85 (Build 0.85.2478.0; release; 10/14/2006)
Copyright (C) 2001-2006 Gerry Shaw
http://nant.sourceforge.net

Buildfile: file:///home/aha/devel/nant/sym.build
Target framework: Mono 2.0 Profile
Target(s) specified: build 


build:


BUILD SUCCEEDED

Total time: 0.1 seconds.

[EMAIL PROTECTED] nant]$ ls
foo.so  foo.so.0  sym.build  sym.build~

and finally execute the clean target:

[EMAIL PROTECTED] nant]$ nant clean
NAnt 0.85 (Build 0.85.2478.0; release; 10/14/2006)
Copyright (C) 2001-2006 Gerry Shaw
http://nant.sourceforge.net

Buildfile: file:///home/aha/devel/nant/sym.build
Target framework: Mono 2.0 Profile
Target(s) specified: clean 


clean:

   [delete] Deleting file /home/aha/devel/nant/foo.so.
   [delete] Deleting file /home/aha/devel/nant/foo.so.0.

BUILD FAILED

/home/aha/devel/nant/sym.build(11,6):
Cannot delete file '/home/aha/devel/nant/foo.so.0'.
    Could not find file "/home/aha/devel/nant/foo.so.0"

Total time: 0 seconds.

Now I know that Windows does not support symbolic links, and from looking at
the source code the problem is that
System.IO.FileInfo.Exsits is false for symbolic links. And DeleteTask.cs
contains the line of code:

if (!deleteInfo.Exists) {
   return;
}

Which causes the function to exit before actually deleting the file, I
didn't follow the trail any farther than that, but I was wondering if anyone
new if NAnt 0.86 supports the deletion of symbolic links?

I've been thinking about a couple of implementations using Mono, however, it
requires the use of a Library that is not Standard in the .NET Framework,
namely Mono.Unix.Native (yes I know it's been deprecated).  Anyway, I am
just wondering what others have tried.

-- 
Aquil H. Abdullah
[EMAIL PROTECTED] 

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to