From f846295a74c1ebdde2fc7c36795ff9374b1719d1 Mon Sep 17 00:00:00 2001 From: ivanovEV Date: Thu, 14 Mar 2024 23:20:40 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=BF=D1=80=D0=B8=D0=B2=D0=B5=D0=B4=D0=B5=D0=BD=D0=B8=D0=B5=20?= =?UTF-8?q?=D0=BA=20=D0=B0=D0=B1=D1=81=D0=BE=D0=BB=D1=8E=D1=82=D0=BD=D0=BE?= =?UTF-8?q?=D0=BC=D1=83=20=D0=BF=D1=83=D1=82=D0=B8.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jenkins/library/steps/GetExtensions.groovy | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/ru/pulsar/jenkins/library/steps/GetExtensions.groovy b/src/ru/pulsar/jenkins/library/steps/GetExtensions.groovy index 4f497f0..bc4a7cd 100644 --- a/src/ru/pulsar/jenkins/library/steps/GetExtensions.groovy +++ b/src/ru/pulsar/jenkins/library/steps/GetExtensions.groovy @@ -78,8 +78,8 @@ class GetExtensions implements Serializable { localPathToExtension.copyFrom(new URL(extension.path)) } else { // If the path is a local file, copy the file - // String localPath = extension.path.startsWith("./") ? "$env.WORKSPACE/${extension.path.substring(1)}" : extension.path - FilePath localFilePath = FileUtils.getFilePath(extension.path) + String localPath = getAbsolutePath(extension.path) + FilePath localFilePath = FileUtils.getFilePath(localPath) localPathToExtension.copyFrom(localFilePath) } } @@ -113,4 +113,13 @@ class GetExtensions implements Serializable { return false } } + + private static String getAbsolutePath(String path) { + // Если путь начинается с / или начинается с \\, или начинается с "Буквы диска" и ":"(Прим C:) то это абсолютный путь + if (path.startsWith("/") || path.startsWith("\\\\") || path.matches("^[A-Za-z]:.*")) { + return path + } else { + return "${env.WORKSPACE}/${path}" + } + } }