From 46166b9b409198875b34d798e8debd5415e428b2 Mon Sep 17 00:00:00 2001 From: Mark Vieira Date: Tue, 28 Jan 2020 19:50:49 -0800 Subject: [PATCH] Restore class that is still in use --- .../gradle/test/JNAKernel32Library.java | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 buildSrc/src/main/java/org/elasticsearch/gradle/test/JNAKernel32Library.java diff --git a/buildSrc/src/main/java/org/elasticsearch/gradle/test/JNAKernel32Library.java b/buildSrc/src/main/java/org/elasticsearch/gradle/test/JNAKernel32Library.java new file mode 100644 index 00000000000..4d069cd434f --- /dev/null +++ b/buildSrc/src/main/java/org/elasticsearch/gradle/test/JNAKernel32Library.java @@ -0,0 +1,25 @@ +package org.elasticsearch.gradle.test; + +import com.sun.jna.Native; +import com.sun.jna.WString; +import org.apache.tools.ant.taskdefs.condition.Os; + +public class JNAKernel32Library { + + private static final class Holder { + private static final JNAKernel32Library instance = new JNAKernel32Library(); + } + + static JNAKernel32Library getInstance() { + return Holder.instance; + } + + private JNAKernel32Library() { + if (Os.isFamily(Os.FAMILY_WINDOWS)) { + Native.register("kernel32"); + } + } + + native int GetShortPathNameW(WString lpszLongPath, char[] lpszShortPath, int cchBuffer); + +}