[FIXED HUDSON-4301] Creation of symlinks failed (or created in wrong location) since 1.320.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@21046 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
mindless committed 2009-08-24 21:36:34 +00:00
1 parent d7ae2279ad
commit cd6a71af00
1 file changed
+3 -2
+3 -2
View File
@@ -887,14 +887,15 @@ public class Util {
if(!isWindows() && !NO_SYMLINK) {
try {
// if a file or a directory exists here, delete it first.
if (new File(symlinkPath).exists())
File symlinkFile = new File(baseDir, symlinkPath);
if (symlinkFile.exists())
// ignore a failure.
new LocalProc(new String[]{"rm","-rf", symlinkPath},new String[0],listener.getLogger(), baseDir).join();
int r;
if (!SYMLINK_ESCAPEHATCH)
r = PosixAPI.get().symlink(targetPath,symlinkPath);
r = PosixAPI.get().symlink(targetPath,symlinkFile.getAbsolutePath());
else // escape hatch, until we know that the above works well.
r = new LocalProc(new String[]{
"ln","-s", targetPath, symlinkPath},