Browse Source

File("foo").getParent() is null if "foo" is a symbolic link - File("./foo").getParent() is not. PR 49137.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@935064 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 15 years ago
parent
commit
7d05241b92
3 changed files with 21 additions and 1 deletions
  1. +4
    -0
      WHATSNEW
  2. +3
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java
  3. +14
    -0
      src/tests/antunit/taskdefs/optional/unix/symlink-test.xml

+ 4
- 0
WHATSNEW View File

@@ -86,6 +86,10 @@ Fixed bugs:
* <jar filesetmanifest="merge"> was broken on Windows. * <jar filesetmanifest="merge"> was broken on Windows.
Bugzilla Report 49090 Bugzilla Report 49090


* <symlink> delete failed if the link attribute was a relative path
to a link inside the current directory without a leading ".".
Bugzilla Report 49137

Other changes: Other changes:
-------------- --------------




+ 3
- 1
src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java View File

@@ -184,7 +184,9 @@ public class Symlink extends DispatchTask {
return; return;
} }
log("Removing symlink: " + link); log("Removing symlink: " + link);
SYMLINK_UTILS.deleteSymbolicLink(new File(link), this);
SYMLINK_UTILS.deleteSymbolicLink(FILE_UTILS
.resolveFile(new File("."), link),
this);
} catch (FileNotFoundException fnfe) { } catch (FileNotFoundException fnfe) {
handleError(fnfe.toString()); handleError(fnfe.toString());
} catch (IOException ioe) { } catch (IOException ioe) {


+ 14
- 0
src/tests/antunit/taskdefs/optional/unix/symlink-test.xml View File

@@ -92,4 +92,18 @@
<au:assertFileDoesntExist file="${output}/link"/> <au:assertFileDoesntExist file="${output}/link"/>
</target> </target>


<target name="testDeleteLinkInSameDirAsBuildFile" depends="setUp" if="isUnix"
description="https://issues.apache.org/bugzilla/show_bug.cgi?id=49137">
<mkdir dir="${output}/Templates"/>
<mkdir dir="${output}/project1"/>
<symlink action="single" link="${output}/project1/Templates"
resource="../Templates"/>
<echo file="${output}/project1/build.xml"><![CDATA[
<project name="project1" default="build" basedir=".">
<target name="build">
<symlink action="delete" link="Templates"/>
</target>
</project>]]></echo>
<ant antfile="${output}/project1/build.xml"/>
</target>
</project> </project>

Loading…
Cancel
Save