Remove commons-io
Gitea/Java-Installer/pipeline/head This commit looks good Details

snapshot
Jonas Letzbor 2023-01-20 13:43:06 +01:00
parent 41f71857b7
commit cac41b53be
Signed by: RPJosh
GPG Key ID: 46D72F589702E55A
3 changed files with 15 additions and 16 deletions

View File

@ -6,8 +6,8 @@ plugins {
// Set version of programm // // Set version of programm //
version = "1.0.3" version = "1.0.4"
def version = "1.0.3" def version = "1.0.4"
group = "de.rpjosh" group = "de.rpjosh"
@ -128,10 +128,6 @@ repositories {
dependencies { dependencies {
// https://mvnrepository.com/artifact/com.github.vatbub/mslinks // https://mvnrepository.com/artifact/com.github.vatbub/mslinks
api group: 'com.github.vatbub', name: 'mslinks', version: '1.0.6.2' api group: 'com.github.vatbub', name: 'mslinks', version: '1.0.6.2'
// https://mvnrepository.com/artifact/commons-io/commons-io
api group: 'commons-io', name: 'commons-io', version: '2.10.0'
} }
tasks.named('jar') { tasks.named('jar') {

View File

@ -5,14 +5,14 @@ import java.io.InputStreamReader;
import java.io.File; import java.io.File;
import java.io.InputStream; import java.io.InputStream;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.apache.commons.io.FileUtils;
/** /**
* Define configuration options for the installation * Define configuration options for the installation
*/ */
@ -612,16 +612,17 @@ public class InstallConfig {
protected boolean getResource(String pathInJar, String pathToWrite, boolean logError) { protected boolean getResource(String pathInJar, String pathToWrite, boolean logError) {
final File jarFile = new File(getLocationOfJarFile()); final File jarFile = new File(getLocationOfJarFile());
try { try {
if (jarFile.isFile()) { if (jarFile.isFile()) {
InputStream in = getClass().getResourceAsStream("/" + pathInJar); InputStream in = getClass().getResourceAsStream("/" + pathInJar);
FileUtils.copyInputStreamToFile(in, new File(pathToWrite));
File file = new File(pathToWrite);
Files.copy(in, file.toPath(), StandardCopyOption.REPLACE_EXISTING);
return true; return true;
} }
return false; return false;
} catch (Exception ex ) { } catch (Exception ex ) {
if (logError) logger.log("w", ex, "getResource"); if (logError) logger.log("w", ex, "getResource");
return false; return false;

View File

@ -2,7 +2,6 @@ package de.rpjosh.installer;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.File; import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.FileWriter; import java.io.FileWriter;
import java.io.InputStreamReader; import java.io.InputStreamReader;
@ -13,6 +12,8 @@ import java.net.HttpURLConnection;
import java.net.URL; import java.net.URL;
import java.nio.channels.Channels; import java.nio.channels.Channels;
import java.nio.channels.ReadableByteChannel; import java.nio.channels.ReadableByteChannel;
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.util.Arrays; import java.util.Arrays;
import java.util.Base64; import java.util.Base64;
@ -25,8 +26,6 @@ import java.util.concurrent.TimeUnit;
import java.util.prefs.Preferences; import java.util.prefs.Preferences;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.apache.commons.io.FileUtils;
import mslinks.ShellLink; import mslinks.ShellLink;
import de.rpjosh.installer.InstallConfig.OSType; import de.rpjosh.installer.InstallConfig.OSType;
@ -144,7 +143,10 @@ public class Installer {
System.out.print("\n" + Tr.get("installation_copyJar") + ": "); System.out.print("\n" + Tr.get("installation_copyJar") + ": ");
try { try {
FileUtils.copyInputStreamToFile(new FileInputStream(new File(jarFile)), new File(conf.getApplicationDir() + conf.getApplicationNameShort() + ".jar")); File source = new File(jarFile);
File destination = new File(conf.getApplicationDir() + conf.getApplicationNameShort() + ".jar");
Files.copy(source.toPath(), destination.toPath(), StandardCopyOption.REPLACE_EXISTING);
} catch (Exception ex) { } catch (Exception ex) {
System.out.println(Tr.get("failed") + ".\n\n" + Tr.get("errorMessage") + ": "); System.out.println(Tr.get("failed") + ".\n\n" + Tr.get("errorMessage") + ": ");
ex.printStackTrace(); ex.printStackTrace();