1
0

Добавил приведение к абсолютному пути.

This commit is contained in:
ivanovEV
2024-03-14 23:20:40 +03:00
parent f45622d533
commit f846295a74

View File

@@ -78,8 +78,8 @@ class GetExtensions implements Serializable {
localPathToExtension.copyFrom(new URL(extension.path)) localPathToExtension.copyFrom(new URL(extension.path))
} else { } else {
// If the path is a local file, copy the file // If the path is a local file, copy the file
// String localPath = extension.path.startsWith("./") ? "$env.WORKSPACE/${extension.path.substring(1)}" : extension.path String localPath = getAbsolutePath(extension.path)
FilePath localFilePath = FileUtils.getFilePath(extension.path) FilePath localFilePath = FileUtils.getFilePath(localPath)
localPathToExtension.copyFrom(localFilePath) localPathToExtension.copyFrom(localFilePath)
} }
} }
@@ -113,4 +113,13 @@ class GetExtensions implements Serializable {
return false 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}"
}
}
} }