Added InternalDirInstaller
This commit is contained in:
parent
f96af286d9
commit
3c123227ec
|
@ -0,0 +1,9 @@
|
||||||
|
package ley.anvil.addonscript.installer;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
public interface IInstaller {
|
||||||
|
|
||||||
|
void install(String[] params, File input);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package ley.anvil.addonscript.installer;
|
||||||
|
|
||||||
|
import ley.anvil.addonscript.installer.IInstaller;
|
||||||
|
|
||||||
|
import java.io.*;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
import java.nio.file.StandardCopyOption;
|
||||||
|
|
||||||
|
public class InternalDirInstaller implements IInstaller {
|
||||||
|
|
||||||
|
public static String ID = "internal.dir";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void install(String[] params, File input) {
|
||||||
|
if (params.length >= 1) {
|
||||||
|
try {
|
||||||
|
InputStream in = new FileInputStream(input);
|
||||||
|
Files.copy(in, Paths.get(params[0]), StandardCopyOption.REPLACE_EXISTING);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException("No directory specified for file " + input.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,9 +0,0 @@
|
||||||
package ley.anvil.addonscript.util;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
public interface IInstaller {
|
|
||||||
|
|
||||||
void install(String[] params, String filelink);
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in a new issue