From 1242edffcb0dff177ec37a1a42f753a7920990d3 Mon Sep 17 00:00:00 2001
From: 潘志宝 <979469083@qq.com>
Date: 星期四, 26 九月 2024 10:39:31 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/common/utils/GenUtils.java |   51 +--------------------------------------------------
 1 files changed, 1 insertions(+), 50 deletions(-)

diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/common/utils/GenUtils.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/common/utils/GenUtils.java
index d03fb95..e411574 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/common/utils/GenUtils.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/common/utils/GenUtils.java
@@ -61,56 +61,6 @@
                 IOUtils.write(sw.toString(), zip, "UTF-8");
                 IOUtils.closeQuietly(sw);
                 zip.closeEntry();
-
-                if (template.equals("cpp.vm")) {
-                    File dirPath = new File("C:/DLUT/tmp/");
-                    if (!dirPath.exists()) {
-                        dirPath.mkdirs();
-                    }
-                    // 生成临时cpp文件
-                    File cppFile = new File(dirPath.getAbsolutePath() + File.separator + entity.getPyName() + ".cpp");
-                    cppFile.createNewFile();
-                    OutputStream cppOutputStream = Files.newOutputStream(cppFile.toPath());
-                    IOUtils.write(sw.toString(), cppOutputStream, "UTF-8");
-                    IOUtils.closeQuietly(cppOutputStream);
-                }
-
-                if (template.equals("Jni.cpp.vm")) {
-                    File dirPath = new File("C:/DLUT/tmp/");
-                    if (!dirPath.exists()) {
-                        dirPath.mkdirs();
-                    }
-
-                    // 生成临时Jni.cpp文件
-                    File cppFile = new File(dirPath.getAbsolutePath() + File.separator + entity.getPyName() + ".cpp");
-                    File jniCppFile = new File(dirPath.getAbsolutePath() + File.separator + entity.getPyName() + "Jni.cpp");
-                    jniCppFile.createNewFile();
-                    OutputStream jniCppOutputStream = Files.newOutputStream(jniCppFile.toPath());
-                    IOUtils.write(sw.toString(), jniCppOutputStream, "UTF-8");
-                    IOUtils.closeQuietly(jniCppOutputStream);
-                    try {
-                        // 根据file 通过cmd命令 生成dll
-                        String dllSavePath = dirPath.getAbsolutePath() + File.separator + entity.getPyName() + ".dll";
-                        String cppFilePath = cppFile.getAbsolutePath();
-                        String jniCppFilePath = jniCppFile.getAbsolutePath();
-//                        String command = "cmd.exe /c cl -o " + dllSavePath + " /LD " + jniCppFilePath + " " + cppFilePath;
-                        String command = "cmd.exe /c cl -o " + dllSavePath + " /LD D:\\work\\mdk\\code\\makeDll\\src\\main\\java\\org\\example\\MakeDll.c D:\\work\\mdk\\code\\makeDll\\src\\main\\java\\org\\example\\MakeDll2.c";
-                        Process process = Runtime.getRuntime().exec(command);
-                        // 等待命令执行完成
-                        process.waitFor();
-
-                        File dllFile = new File(dllSavePath);
-                        //添加到zip
-                        zip.putNextEntry(new ZipEntry("dll" + File.separator + entity.getPyName() + ".dll"));
-                        IOUtils.write(FileUtils.readFileToByteArray(dllFile), zip);
-                        zip.closeEntry();
-
-                        FileUtils.deleteDirectory(dirPath);
-                    } catch (InterruptedException e) {
-                        log.error("DLL生成失败" + entity.getPyName(), e);
-                        throw new RuntimeException(e);
-                    }
-                }
             } catch (IOException e) {
                 log.error("渲染模板失败,模型名称:" + entity.getPyName(), e);
                 throw new RuntimeException("渲染模板失败,模型名称:" + entity.getPyName(), e);
@@ -181,5 +131,6 @@
         }
 
         FileUtil.writeUtf8String(writer.toString(),toFile);
+        IOUtils.closeQuietly(writer);
     }
 }

--
Gitblit v1.9.3