2023年6月16日16:37:48

master
zhangmeng 2023-06-19 17:51:05 +08:00
parent c17148d199
commit 3ad143463b
2 changed files with 7 additions and 1 deletions

View File

@ -9,6 +9,7 @@
<description>mystyle-java-fx-tools</description> <description>mystyle-java-fx-tools</description>
<properties> <properties>
<maven.compiler.encoding>UTF-8</maven.compiler.encoding>
<maven.compiler.source>17</maven.compiler.source> <maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target> <maven.compiler.target>17</maven.compiler.target>
<netty.version>4.1.48.Final</netty.version> <netty.version>4.1.48.Final</netty.version>

View File

@ -454,11 +454,16 @@ public class MusicDownloadController {
public static void save_file(String save_path,String download_url){ public static void save_file(String save_path,String download_url){
try { try {
Path path1 = Paths.get(save_path); Path path1 = Paths.get(save_path);
File file = path1.toFile();
if (!file.exists()){
file.createNewFile();
}
boolean exists = Files.exists(path1); boolean exists = Files.exists(path1);
if (!exists){ if (!exists){
Files.createFile(path1); Files.createFile(path1);
} }
File file = path1.toFile();
FileOutputStream fs = new FileOutputStream(file); FileOutputStream fs = new FileOutputStream(file);
URL url = new URL(download_url); URL url = new URL(download_url);
InputStream inputStream = url.openStream(); InputStream inputStream = url.openStream();