12/27 自动创建目录

dev_unify
wangwei 3 months ago
parent 668a1e768d
commit 163c299ab7

@ -4,6 +4,11 @@ import com.glxp.api.util.RsaUtils;
import org.springframework.context.ApplicationContextInitializer;
import org.springframework.context.ConfigurableApplicationContext;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
public class ToolApplicationContextInitializer implements ApplicationContextInitializer {
@Override
@ -18,14 +23,30 @@ public class ToolApplicationContextInitializer implements ApplicationContextInit
"hbn1tobX+al4XvfRpjoCjST2mRfqCt4aNuBDM1LHMzyMBVJpfui91ikLGMgP4Gdf" +
"swIDAQAB";
try {
createTmpDirectoryIfWindows();
// String result = RsaUtils.publicKeyDecrypt(myKey, publicKey);
// String hardInfo = MyHardWareUtils.getHardDiskSN();
// if (!result.equals(hardInfo)) {
// System.exit(1);
// System.exit(1);
// }
} catch (Exception e) {
e.printStackTrace();
System.exit(1);
}
}
private void createTmpDirectoryIfWindows() {
String os = System.getProperty("os.name").toLowerCase();
if (os.contains("win")) {
Path path = Paths.get("D:/tmp");
if (!Files.exists(path)) {
try {
Files.createDirectories(path);
System.out.println("目录创建成功");
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}

Loading…
Cancel
Save