From 1bcc2f5de1465a7a302f1da25e666e35cfc5ff61 Mon Sep 17 00:00:00 2001 From: brinn <brinn> Date: Tue, 1 Jul 2008 14:21:34 +0000 Subject: [PATCH] add: method tryCopyNativeLibraryToTempFile() SVN: 6948 --- .../cisd/common/utilities/FileUtilities.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/common/source/java/ch/systemsx/cisd/common/utilities/FileUtilities.java b/common/source/java/ch/systemsx/cisd/common/utilities/FileUtilities.java index 48d0d8dd22e..c6fd50fb8a2 100644 --- a/common/source/java/ch/systemsx/cisd/common/utilities/FileUtilities.java +++ b/common/source/java/ch/systemsx/cisd/common/utilities/FileUtilities.java @@ -928,6 +928,22 @@ public final class FileUtilities } } + /** + * Tries to copy a native library which is available as a resource to a temporary file. It will + * use the following naming schema to locate the resource containing the native library: + * <p> + * <code>/native/<libname>/<platform_id>/<libname>.so</code>. + * + * @param libraryName The name of the library. + * @return The name of the temporary file, or <code>null</code>, if the resource could not be + * copied. + */ + public final static String tryCopyNativeLibraryToTempFile(final String libraryName) + { + return tryCopyResourceToTempFile(String.format("/native/%s/%s/%s.so", libraryName, + OSUtilities.getComputerPlatform(), libraryName), libraryName, ".so"); + } + /** * Tries to copy the resource with the given name to a temporary file. * -- GitLab