58 Commits
Author SHA1 Message Date
sugoidogo bd2ca700d5 remove old support information 2025-12-15 11:35:25 +00:00
SugoiDogoandGitHub 654d70c17b Update README.md 2022-10-15 18:43:49 -06:00
SugoiDogoandGitHub 573de4b4c2 Update README.md 2022-10-15 18:18:09 -06:00
SugoiDogoandGitHub 95730a0002 Update README.md 2022-10-15 06:25:14 -06:00
SugoiDogoandGitHub c75801fc07 Update README.md 2022-10-05 16:25:25 -06:00
SugoiDogoandGitHub 4e4e5919d6 Update README.md 2022-10-01 15:56:21 -06:00
SugoiDogoandGitHub 70e11d4277 Update README.md 2022-03-31 13:39:37 -06:00
Joseph mendozaandGitHub f6228ca729 Update README.md 2020-03-22 20:50:31 -07:00
Joseph mendozaandGitHub 321a03a36e Update README.md 2020-03-22 20:41:36 -07:00
Joseph mendozaandGitHub 2682eac500 Delete dub.sdl 2020-03-22 20:40:05 -07:00
Joseph mendozaandGitHub a345dfa495 Delete libcurl.dll 2020-03-22 20:39:52 -07:00
Joseph mendozaandGitHub 83894674dc Delete curl.lib 2020-03-22 20:39:40 -07:00
Joseph mendozaandGitHub 7a7e813c7e Delete gui.d 2020-03-22 20:39:30 -07:00
Joseph mendozaandGitHub b5ca94ae58 Delete cli.d 2020-03-22 20:39:23 -07:00
Joseph mendozaandGitHub 92d1d52ec2 Delete adbi.d 2020-03-22 20:39:16 -07:00
josephsmendoza 2ad1b8dc97 java rewrite 2020-03-22 19:40:37 -07:00
josephsmendoza 8c29691361 UI & search improvements 2019-10-17 01:17:50 -07:00
josephsmendoza c392631339 fix "failed to load curl" 2019-10-11 02:14:14 -07:00
josephsmendoza c5de32f6dd fix windows search path 2019-10-11 02:04:59 -07:00
josephsmendoza 2df8f900d6 fixed installer issues 2019-10-11 01:00:25 -07:00
josephsmendoza 73abfb8fa8 GUI done, abi needs fix before release 2019-10-10 15:33:35 -07:00
Joseph mendozaandGitHub a62f1e998f Delete build.sh 2019-09-23 23:58:59 -07:00
Joseph mendozaandGitHub 7821de4bb4 Delete build.ps1 2019-09-23 23:58:50 -07:00
Joseph Mendoza 97a89f4382 basic gui alost done 2 2019-09-23 23:58:09 -07:00
Joseph Mendoza 7aab701aa1 basic gui almost done 2019-09-23 23:57:09 -07:00
josephsmendoza b8686d4a04 proper dub project structure 2019-09-11 05:40:28 -07:00
Joseph mendozaandGitHub 2be4c47213 Update README.md 2019-09-10 19:26:44 -07:00
Joseph mendozaandGitHub d5582d17e3 Delete gui.d 2019-09-10 19:18:10 -07:00
Joseph mendozaandGitHub ba1ba3937d Delete cli.d 2019-09-10 19:17:55 -07:00
Joseph mendozaandGitHub fef18f8b68 Delete build.sh 2019-09-10 19:17:45 -07:00
Joseph mendozaandGitHub d137448a7b Delete build.cmd 2019-09-10 19:17:34 -07:00
Joseph mendozaandGitHub 4ce50aa635 Delete adbi.d 2019-09-10 19:17:23 -07:00
Joseph mendozaandGitHub ed5f4d7813 Delete adbi.cmd 2019-09-10 19:17:07 -07:00
josephsmendoza 433330f743 Merge branch 'master' of https://github.com/josephsmendoza/ADB-Installer 2019-09-10 19:08:33 -07:00
josephsmendoza e7f00bdff7 pre-gui work 2019-09-10 19:07:57 -07:00
Joseph mendozaandGitHub 550e52cf1e Update README.md 2019-08-31 22:24:46 -07:00
Joseph Mendoza 0077844000 mac version working 2019-08-31 21:57:09 -07:00
josephsmendoza c086ad5552 fixed typo 2019-08-15 00:33:59 -07:00
josephsmendoza 0c298432f2 Update adbi.cmd 2019-08-15 00:31:38 -07:00
Joseph mendozaandGitHub 981fea7af8 Create build.sh 2019-08-14 23:17:39 -07:00
Joseph mendozaandGitHub edd7717a08 Update README.md 2019-08-14 23:16:04 -07:00
Joseph mendozaandGitHub 5fc505d789 Merge pull request #2 from josephsmendoza/dlang
Dlang conversion
2019-08-14 15:51:57 -07:00
josephsmendoza fa59eed572 D command line basics done 2019-08-14 15:50:24 -07:00
Josef Mendoza d9e3ca1f50 d conversion start 2019-08-12 01:57:38 -07:00
Josef Mendoza 51c1c71475 d conversion start 2019-08-12 01:57:14 -07:00
Joseph mendozaandGitHub 0e8df6cf77 Update and rename sfx.txt to build.cmd 2019-08-10 12:43:38 -07:00
Joseph mendozaandGitHub b23ded7286 Update README.md 2019-08-10 12:40:16 -07:00
f238391707 Update build.gradle 2019-07-29 03:54:46 -07:00
Joseph mendozaandGitHub 64e8e294c4 Update build.gradle 2019-07-29 03:45:53 -07:00
Joseph mendozaandGitHub dd4ba9f34a Merge pull request #1 from josephsmendoza/java
Java conversion
2019-07-19 17:59:07 -07:00
Joseph mendozaandGitHub 5513cabf3e Update README.md 2019-07-19 17:58:39 -07:00
josephsmendoza cc541e78de java conversion complete 2019-07-19 17:53:20 -07:00
josephsmendoza 2d31e5199f finished windows java portion 2019-07-16 19:47:18 -07:00
josephsmendoza c5fa538b42 added search for adb function 2019-07-12 23:48:57 -07:00
josephsmendoza 32d0f1cde8 Merge branch 'master' of https://github.com/josephsmendoza/ADB-Installer 2019-07-12 13:01:21 -07:00
josephsmendoza 83fc93c670 win 7 compat and big speed boost 2019-07-12 12:59:33 -07:00
Joseph mendozaandGitHub 0925798199 Update README.md 2019-07-10 22:39:41 -07:00
josephsmendoza 2c2501f89b fixed issue when install path doesn't exist 2019-07-05 09:05:48 -07:00
9 changed files with 437 additions and 107 deletions
+7
View File
@@ -0,0 +1,7 @@
bin
build
.gradle
.vscode
.settings
.classpath
.project
+4 -6
View File
@@ -1,14 +1,12 @@
# ADB-Installer
# Android Debug Bridge Installer
Download from [Releases](https://github.com/josephsmendoza/ADB-Installer/releases)
This is a re-implementation of the [15 seconds ADB Installer](https://forum.xda-developers.com/showthread.php?t=2588979)
This installer requires an internet connection.
The main component is [the PowerShell script](https://github.com/josephsmendoza/ADB-Installer/blob/master/install.ps1) which downloads [the latest android platform tools for windows](https://dl.google.com/android/repository/platform-tools-latest-windows.zip) and installs them to either `C:\adb`, an auto-detected previous install location, or a path you can specify via `-installPath`.
Icon is from [material.io](https://material.io/resources/icons/?icon=bug_report&style=baseline)
For conveinence, this is wrapped in an `.exe` file which runs the script with `ExecutionPolicy` set to `Bypass`. This file is fully automated.
Windows version packaged with [7zip](https://www.7-zip.org/)
Icon is from [Google via icon-icons.com](https://icon-icons.com/icon/adb/90476)
Built with [7z SFX Builder](https://sourceforge.net/projects/s-zipsfxbuilder)
Linux & Mac version packaged with [makeself](https://makeself.io/)
-48
View File
@@ -1,48 +0,0 @@
Param( [Parameter(Position=0)] [String[]] $installPath )
Set-PSDebug -Trace 2
$ErrorActionPreference = 'Inquire'
$shell = New-Object -ComObject Wscript.Shell
$adb=Get-Command "adb" -ErrorAction SilentlyContinue
$fastboot=Get-Command "fastboot" -ErrorAction SilentlyContinue
if($installPath.Length.Equals(0)){
if(!$adb -and $fastboot){
$installPath=fastboot --version | Select-String -Pattern "(?<=installed as )(.+)(?=\\.*\.exe)" | % { $_.Matches } | % { $_.Value }
}
if($adb){
$installPath=adb --version | Select-String -Pattern "(?<=installed as )(.+)(?=\\.*\.exe)" | % { $_.Matches } | % { $_.Value }
Invoke-Command -ScriptBlock {
$ErrorActionPreference = 'Ignore'
adb kill-server
}
}
if($installPath.Length.Equals(0)){
$installPath="$env:APPDATA\SideQuest\platform-tools"
}
}
if ( (cmd /c sc query Windefend) -like "*RUNNING*" ){
Add-MpPreference -ExclusionPath $installPath
Add-MpPreference -ExclusionProcess "adb.exe"
} else {
$shell.Popup("Windows Defender is not running!
If you have antivirus, exclude $installPath")
}
if(!$adb -and !$fastboot){
$oldpath = (Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH).path
$newpath = "$oldpath;$installPath"
Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH -Value $newPath
}
Import-Module BitsTransfer
Start-BitsTransfer -Source "https://dl.google.com/android/repository/platform-tools-latest-windows.zip" -Destination "$env:temp\platform-tools-latest-windows.zip"
Set-PSDebug -Off
Expand-Archive -Path "$env:temp\platform-tools-latest-windows.zip" -DestinationPath "$env:temp" -Force
Set-PSDebug -Trace 2
Copy-Item -Path "$env:temp\platform-tools\*" -Destination "$installPath\" -Force
$PSScriptRootLegacy=split-path -parent $MyInvocation.MyCommand.Definition
Start-Process $PSScriptRootLegacy/android_winusb.inf -Verb Install
$shell.Popup("Done!")
+36
View File
@@ -0,0 +1,36 @@
plugins {
id 'java'
id 'application'
id "org.beryx.runtime" version "1.8.0" //https://plugins.gradle.org/plugin/org.beryx.runtime
}
sourceSets.main.java.srcDirs = ['src']
application.mainClassName = 'gui'
repositories {
jcenter()
mavenCentral()
google()
maven { url 'https://jitpack.io' }
}
dependencies {
implementation 'info.picocli:picocli:4.2.0'
}
runtime {
options = ['--strip-debug','--no-header-files','--no-man-pages']
modules = ['java.desktop','jdk.crypto.ec']
}
task sfx(type: Exec,dependsOn: "runtime"){
int complevel=1
workingDir runtime.imageDir
String dest="../"+application.applicationName
if(System.getProperty("os.name").toLowerCase().startsWith("win")){
doFirst{
new File("build/image/setup.bat").text="@echo off\ncall bin/"+applicationName+".bat"
}
String stub="7zs2con.sfx"
executable "7z"
args "a",dest,"-mx"+complevel,"-sfx"+stub
}else{
executable "makeself"
args "--complevel",complevel,".",dest+".sh",application.applicationName,"bin/adbi"
}
}
-45
View File
@@ -1,45 +0,0 @@
Param( [Parameter(Position=0)] [String[]] $installPath )
Set-PSDebug -Trace 2
$ErrorActionPreference = 'Inquire'
$shell = New-Object -ComObject Wscript.Shell
$adb=Get-Command "adb" -ErrorAction SilentlyContinue
$fastboot=Get-Command "fastboot" -ErrorAction SilentlyContinue
if($installPath.Length.Equals(0)){
if(!$adb -and $fastboot){
$installPath=fastboot --version | Select-String -Pattern "(?<=installed as )(.+)(?=\\.*\.exe)" | % { $_.Matches } | % { $_.Value }
}
if($adb){
$installPath=adb --version | Select-String -Pattern "(?<=installed as )(.+)(?=\\.*\.exe)" | % { $_.Matches } | % { $_.Value }
Invoke-Command -ScriptBlock {
$ErrorActionPreference = 'Ignore'
adb kill-server
}
}
if($installPath.Length.Equals(0)){
$installPath="C:\android-platform-tools"
}
}
if ( (cmd /c sc query Windefend) -like "*RUNNING*" ){
Add-MpPreference -ExclusionPath $installPath
Add-MpPreference -ExclusionProcess "adb.exe"
} else {
$shell.Popup("Windows Defender is not running!
If you have antivirus, exclude $installPath")
}
if(!$adb -and !$fastboot){
$oldpath = (Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH).path
$newpath = "$oldpath;$installPath"
Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH -Value $newPath
}
Import-Module BitsTransfer
Start-BitsTransfer -Source "https://dl.google.com/android/repository/platform-tools-latest-windows.zip" -Destination "$env:temp\platform-tools-latest-windows.zip"
Set-PSDebug -Off
Expand-Archive -Path "$env:temp\platform-tools-latest-windows.zip" -DestinationPath "$env:temp" -Force
Set-PSDebug -Trace 2
Copy-Item -Path "$env:temp\platform-tools\*" -Destination "$installPath\" -Force
$shell.Popup("Done!")
-8
View File
@@ -1,8 +0,0 @@
;!@Install@!UTF-8!
RunProgram="powershell -executionpolicy bypass -file %%T\install.ps1"
;Config file generated by 7z SFX Builder v2.1. (http://sourceforge.net/projects/s-zipsfxbuilder/)
;!@InstallEnd@!
7zSFXBuilder_7zArchive=C:\Users\Josef\Documents\ADB-Installer\install.7z
7zSFXBuilder_SFXIcon=C:\Users\Josef\Documents\ADB-Installer\adb.ico
7zSFXBuilder_UseDefMod=7zsd_All_x64
7zSFXBuilder_UPXCommands=--best --all-methods
+189
View File
@@ -0,0 +1,189 @@
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.nio.file.attribute.PosixFilePermissions;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
public class adbi {
private final String os;
public adbi() throws Exception {
switch (System.getProperty("os.name").substring(0, 3).toLowerCase()) {
case "win": {
os = "windows";
break;
}
case "mac": {
os = "darwin";
break;
}
case "lin": {
os = "linux";
break;
}
default: {
throw new Exception("unknown os");
}
}
}
public String getHome() {
if (os == "windows") {
return System.getenv("HOMEPATH");
} else {
return System.getenv("HOME");
}
}
public boolean isPathPrivileged(String path) {
return path.startsWith(getHome());
}
public String getCannonicalPath(String path) {
return Paths.get(path).toAbsolutePath().normalize().toString();
}
public String getDefaultInstallPath(boolean privileged) {
String append = "/Android/SDK/platform-tools";
if (privileged) {
switch (os) {
case "windows": {
return System.getenv("programfiles") + append;
}
case "darwin": {
return "/Library" + append;
}
default: {
return "/opt" + append;
}
}
} else {
switch (os) {
case "windows": {
return System.getenv("localappdata") + append;
}
case "darwin": {
return System.getenv("HOME") + "/Library" + append;
}
default: {
return System.getenv("HOME") + append;
}
}
}
}
private InputStream getUrlStream() throws MalformedURLException, IOException {
return new URL("https://dl.google.com/android/repository/platform-tools-latest-" + os + ".zip").openStream();
}
private boolean isNeeded(String name, int mode) {
switch (mode) {
case (1): {
if (name.startsWith("fastboot"))
return true;
}
case (0): {
return name.toLowerCase().startsWith("adb");
}
default: {
return true;
}
}
}
public void download(String dir, int mode) throws MalformedURLException, IOException {
ZipInputStream zInputStream = new ZipInputStream(getUrlStream());
ZipEntry zEntry = zInputStream.getNextEntry();
while (zEntry != null) {
String name = zEntry.getName().substring(15);
if (isNeeded(name, mode) && zEntry.getSize() > 0) {
Path dest = Paths.get(dir, name);
Files.createDirectories(dest.getParent());
Files.write(dest, zInputStream.readAllBytes());
if (os != "windows") {
Files.setPosixFilePermissions(dest, PosixFilePermissions.fromString("755"));
}
}
zEntry = zInputStream.getNextEntry();
}
}
public void install(String dir, boolean privileged) throws Exception {
if (System.getenv("PATH").contains(dir)) {
return;
}
if (os == "windows") {
installWindows(dir, privileged);
} else {
installPosix(dir, privileged);
}
}
private void installPosix(String dir, boolean privileged) throws IOException {
Path profile = getProfilePath(privileged);
String path = "export PATH=$PATH:\"" + dir + "\"";
if (Files.exists(profile) && Files.readAllLines(profile).add(path)) {
Files.writeString(profile, "\n" + path, StandardOpenOption.APPEND);
} else {
Files.writeString(profile, path);
}
}
private Path getProfilePath(boolean privileged) {
if (privileged) {
return Paths.get("/etc/profile");
} else {
Path home = Paths.get(System.getenv("HOME"));
if (os == "darwin") {
return home.resolve(".bash_profile");
} else {
return home.resolve(".bashrc");
}
}
}
private void installWindows(String dir, boolean privileged) throws Exception {
String type = "REG_EXPAND_SZ";
String valueName = "Path";
String keyName = getKeyName(privileged);
String path = regQuery(keyName, valueName, type);
if (path.contains(dir)) {
return;
}
regAdd(keyName, valueName, type, path + ";" + dir + ";");
}
private void regAdd(String keyName, String valueName, String type, String data) throws Exception {
Process p = Runtime.getRuntime()
.exec(new String[] { "reg", "add", keyName, "/v", valueName, "/t", type, "/d", data, "/f" });
if (p.waitFor() != 0) {
throw new Exception(new String(p.getErrorStream().readAllBytes()));
}
}
private String regQuery(String keyName, String valueName, String type) throws Exception {
Process p = Runtime.getRuntime().exec(new String[] { "reg", "query", keyName, "/v", valueName });
if (p.waitFor() != 0) {
throw new Exception(new String(p.getErrorStream().readAllBytes()));
}
return new String(p.getInputStream().readAllBytes()).replace(keyName, "").replace(valueName, "")
.replace(type, "").trim();
}
private String getKeyName(boolean privileged) {
if (privileged) {
return "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment";
} else {
return "HKEY_CURRENT_USER\\Environment";
}
}
}
+64
View File
@@ -0,0 +1,64 @@
import picocli.CommandLine;
import picocli.CommandLine.Command;
import picocli.CommandLine.Option;
import picocli.CommandLine.ParseResult;
@Command(name = "adbi", description = "install adb", mixinStandardHelpOptions = true, version = "beta")
public class cli implements Runnable {
@Option(names = { "-i", "--install-dir" }, description = "directory to install to")
String dir;
@Option(names = { "-u", "--user-mode" }, description = "unpriveleged install, current user only")
boolean user;
@Option(names = { "-f", "--add-fastboot" }, description = "include fastboot")
boolean fastboot;
@Option(names = { "-a", "--add-all" }, description = "include everything")
boolean all;
@Option(names = { "-d", "--download-only" }, description = "do not try to add adb to PATH")
boolean downloadOnly;
public static void main(String[] args) {
new cli(args).run();
}
public cli(String[] args) {
CommandLine cli = new CommandLine(this);
ParseResult argv = cli.parseArgs(args);
if (argv.isUsageHelpRequested()) {
cli.usage(System.err);
System.exit(0);
}
if (argv.isVersionHelpRequested()) {
cli.printVersionHelp(System.err);
System.exit(0);
}
}
@Override
public void run() {
int mode = 0;
if (fastboot)
mode += 1;
if (all)
mode += 2;
try {
adbi adbi = new adbi();
if (dir == null)
dir = adbi.getDefaultInstallPath(!user);
else{
if(!user && !adbi.isPathPrivileged(dir)){
user=true;
System.out.println("User directory specified, switching to user mode");
}
}
dir = adbi.getCannonicalPath(dir);
adbi.download(dir, mode);
if (!downloadOnly) {
adbi.install(dir, !user);
}
} catch (Exception e) {
e.printStackTrace();
System.exit(e.hashCode());
}
}
}
+137
View File
@@ -0,0 +1,137 @@
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.LayoutManager;
import java.io.File;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.UIManager;
public class gui extends JFrame {
private static final long serialVersionUID = -2628083151723078126L;
private final adbi adbi;
private final gui gui = this;
private final LayoutManager manager = new GridBagLayout();
private final GridBagConstraints constraints = new GridBagConstraints();
private final String title = "ADBi";
private final JComboBox<String> installPath = new JComboBox<String>();
private final JButton startButton = new JButton("Start");
private final JRadioButton adb = new JRadioButton("adb");
private final JRadioButton fastboot = new JRadioButton("adb and fastboot");
private final JRadioButton all = new JRadioButton("everything");
private final ButtonGroup components = new ButtonGroup();
private final JLabel componentsLabel = new JLabel("From platform-tools, install:");
private final JButton selectFolderButton = new JButton(UIManager.getIcon("FileView.directoryIcon"));
private final JLabel installPathLabel = new JLabel("Install to:");
private final JCheckBox download = new JCheckBox("Download/Update only, don't install");
private JFileChooser fileChooser = new JFileChooser();
public static void main(String[] args) {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
new gui();
} catch (Exception e) {
e.printStackTrace(System.err);
JOptionPane.showMessageDialog(null, e.getMessage(), e.getClass().getSimpleName(), JOptionPane.ERROR_MESSAGE);
System.exit(1);
}
}
public gui() throws Exception {
adbi = new adbi();
setDefaultCloseOperation(EXIT_ON_CLOSE);
setTitle(title);
setLayout(manager);
constraints.gridx = GridBagConstraints.RELATIVE;
constraints.gridy = 1;
constraints.fill = GridBagConstraints.HORIZONTAL;
add(installPath, constraints);
constraints.fill = GridBagConstraints.NONE;
add(selectFolderButton, constraints);
constraints.gridx = 0;
constraints.gridy = 0;
constraints.fill = GridBagConstraints.HORIZONTAL;
constraints.gridwidth = GridBagConstraints.REMAINDER;
add(installPathLabel, constraints);
constraints.gridy = 2;
add(componentsLabel, constraints);
constraints.gridy = GridBagConstraints.RELATIVE;
add(adb, constraints);
add(fastboot, constraints);
add(all, constraints);
add(download, constraints);
add(startButton, constraints);
components.add(adb);
components.add(fastboot);
components.add(all);
adb.setSelected(true);
installPath.addItem(adbi.getDefaultInstallPath(true));
installPath.addItem(adbi.getDefaultInstallPath(false));
installPath.setSelectedIndex(0);
installPath.setEditable(true);
pack();
selectFolderButton.addActionListener(l -> selectFolder());
startButton.addActionListener(l -> start());
setVisible(true);
fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
}
private void start() {
JPanel statusPanel = new JPanel(manager);
JLabel statusLabel = new JLabel("Setting up");
statusPanel.add(statusLabel, constraints);
gui.setContentPane(statusPanel);
int x = 0;
if (fastboot.isSelected())
x += 1;
if (all.isSelected())
x += 2;
final int mode = x;
final String dir = adbi.getCannonicalPath((String) installPath.getSelectedItem());
final boolean privileged = adbi.isPathPrivileged(dir);
new Thread(() -> {
try {
statusLabel.setText("Downloading");
adbi.download(dir, mode);
if (!download.isSelected()) {
statusLabel.setText("Installing");
adbi.install(dir, privileged);
}
JOptionPane.showMessageDialog(gui, "Done", "ADBi", JOptionPane.INFORMATION_MESSAGE);
System.exit(0);
} catch (Exception e) {
e.printStackTrace(System.err);
JOptionPane.showMessageDialog(gui, e.getMessage() + "\n" + e.getClass().getSimpleName(),
"Install Failed", JOptionPane.ERROR_MESSAGE);
System.exit(1);
}
}).start();
}
private void selectFolder() {
fileChooser.showOpenDialog(gui);
try{
installPath.setSelectedItem(fileChooser.getSelectedFile().getAbsolutePath());
}catch(NullPointerException e){
//non-issue
}
}
}