hellokaton / webp-io

🌚 general format images and webp transform each other
Apache License 2.0
44 stars 18 forks source link

Linux arch is amd64 when using Oracle Java 8 #2

Closed ky6uhetc closed 5 years ago

ky6uhetc commented 6 years ago

Hello! I use Oracle JDK in my project and Linux architecture is detected as amd64. Thus webp bin files could not be copied to CWEBP_TMP_DIR. My workaround is simple:

` private static String getOsName() {

    // windows
    if (OS_NAME.indexOf("win") >= 0) {
        boolean is64bit = (System.getenv("ProgramFiles(x86)") != null);
        return "windows_" + (is64bit ? "x86_64" : "x86");
    } else if (OS_NAME.indexOf("mac") >= 0) {
        // mac osx
        return "mac_" + OS_ARCH;
    } else if (OS_NAME.indexOf("nix") >= 0 || OS_NAME.indexOf("nux") >= 0 || OS_NAME.indexOf("aix") > 0) {
        // unix
        return "amd64".equalsIgnoreCase(OS_ARCH) ? "linux_x86_64" : "linux_" + OS_ARCH;
    } else {
        throw new WebpIOException("Hi boy, Your OS is not support!!");
    }
}`
1pavanb commented 5 years ago

Hello! I use Oracle JDK in my project and Linux architecture is detected as amd64. Thus webp bin files could not be copied to CWEBP_TMP_DIR. My workaround is simple:

` private static String getOsName() {

    // windows
    if (OS_NAME.indexOf("win") >= 0) {
        boolean is64bit = (System.getenv("ProgramFiles(x86)") != null);
        return "windows_" + (is64bit ? "x86_64" : "x86");
    } else if (OS_NAME.indexOf("mac") >= 0) {
        // mac osx
        return "mac_" + OS_ARCH;
    } else if (OS_NAME.indexOf("nix") >= 0 || OS_NAME.indexOf("nux") >= 0 || OS_NAME.indexOf("aix") > 0) {
        // unix
        return "amd64".equalsIgnoreCase(OS_ARCH) ? "linux_x86_64" : "linux_" + OS_ARCH;
    } else {
        throw new WebpIOException("Hi boy, Your OS is not support!!");
    }
}`

Hi @ky6uhetc , The owner for some reason has not responded, it would be cool if this was merged.

to use your solution I copied the whole package for this repo into my project and made the modification you said. am I doing the right way?

ky6uhetc commented 5 years ago

Hello! I use Oracle JDK in my project and Linux architecture is detected as amd64. Thus webp bin files could not be copied to CWEBP_TMP_DIR. My workaround is simple: ` private static String getOsName() {

    // windows
    if (OS_NAME.indexOf("win") >= 0) {
        boolean is64bit = (System.getenv("ProgramFiles(x86)") != null);
        return "windows_" + (is64bit ? "x86_64" : "x86");
    } else if (OS_NAME.indexOf("mac") >= 0) {
        // mac osx
        return "mac_" + OS_ARCH;
    } else if (OS_NAME.indexOf("nix") >= 0 || OS_NAME.indexOf("nux") >= 0 || OS_NAME.indexOf("aix") > 0) {
        // unix
        return "amd64".equalsIgnoreCase(OS_ARCH) ? "linux_x86_64" : "linux_" + OS_ARCH;
    } else {
        throw new WebpIOException("Hi boy, Your OS is not support!!");
    }
}`

Hi @ky6uhetc , The owner for some reason has not responded, it would be cool if this was merged.

to use your solution I copied the whole package for this repo into my project and made the modification you said. am I doing the right way?

Hi @1pavanb , sorry for long time answer! Yes, that's what i did.