完善BT下载器,机器人可以控制刷新下载了

This commit is contained in:
yutou
2021-04-08 15:40:59 +08:00
parent 07a239ab1e
commit bdc74957aa
17 changed files with 89 additions and 59 deletions

View File

@@ -47,9 +47,9 @@ public class MavenWrapperDownloader {
private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
public static void main(String args[]) {
System.out.println("- Downloader started");
com.yutou.nas.utils.Log.i("- Downloader started");
File baseDirectory = new File(args[0]);
System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
com.yutou.nas.utils.Log.i("- Using base directory: " + baseDirectory.getAbsolutePath());
// If the maven-wrapper.properties exists, read it and check if it contains a custom
// wrapperUrl parameter.
@@ -63,7 +63,7 @@ public class MavenWrapperDownloader {
mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
} catch (IOException e) {
System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
com.yutou.nas.utils.Log.i("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
} finally {
try {
if (mavenWrapperPropertyFileInputStream != null) {
@@ -74,22 +74,22 @@ public class MavenWrapperDownloader {
}
}
}
System.out.println("- Downloading from: " + url);
com.yutou.nas.utils.Log.i("- Downloading from: " + url);
File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
if (!outputFile.getParentFile().exists()) {
if (!outputFile.getParentFile().mkdirs()) {
System.out.println(
com.yutou.nas.utils.Log.i(
"- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
}
}
System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
com.yutou.nas.utils.Log.i("- Downloading to: " + outputFile.getAbsolutePath());
try {
downloadFileFromURL(url, outputFile);
System.out.println("Done");
com.yutou.nas.utils.Log.i("Done");
System.exit(0);
} catch (Throwable e) {
System.out.println("- Error downloading");
com.yutou.nas.utils.Log.i("- Error downloading");
e.printStackTrace();
System.exit(1);
}