From cd6a71af005ba6b2bb553c56519a4e6eb32d5c2d Mon Sep 17 00:00:00 2001 From: mindless Date: Mon, 24 Aug 2009 21:36:34 +0000 Subject: [PATCH] [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 --- core/src/main/java/hudson/Util.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/hudson/Util.java b/core/src/main/java/hudson/Util.java index 3d03eb22d4..21ac7767c9 100644 --- a/core/src/main/java/hudson/Util.java +++ b/core/src/main/java/hudson/Util.java @@ -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},