package com.anton.fastcloud.natives;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;

public class Natives {
    public static final String[] LIB_NAMES = {"libnatives.so"};

    public static void init() {
        try {
            Path tempDirPath = Files.createTempDirectory("fastcloud-natives");
            for (String libName : LIB_NAMES) {
                Path libPath = tempDirPath.resolve(libName);
                Files.copy(Natives.class.getResourceAsStream("/" + libName), libPath);
                System.load(libPath.toString());
//                if (!libPath.toFile().delete()) {
//                    throw new IOException("Can't remove temp files");
//                }
            }
//            if (!tempDirPath.toFile().delete()) {
//                throw new IOException("Can't remove temp files");
//            }
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}

@@ -572,18 +572,16 @@
 ing());%0A
-//
         
@@ -614,34 +614,32 @@
 e().delete()) %7B%0A
-//
                 
@@ -684,34 +684,32 @@
 e temp files%22);%0A
-//
                 
@@ -724,18 +724,16 @@
       %7D%0A
-//
         
@@ -774,18 +774,16 @@
 te()) %7B%0A
-//
         
@@ -844,10 +844,8 @@
 %22);%0A
-//
     

Fix temp files removing