Skip to content

Commit e23050c

Browse files
authored
update paths for local dev, fix smarttube link (#28)
1 parent ab13524 commit e23050c

File tree

3 files changed

+29
-8
lines changed

3 files changed

+29
-8
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,4 @@ npm-debug.log.*
3131
package-lock.json
3232
.vscode
3333
.idea
34+
apks

release/app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "android-toolkit",
3-
"version": "1.5.22",
3+
"version": "1.5.23",
44
"description": "Universal app with gui for simple adb connection",
55
"main": "./dist/main/main.js",
66
"author": {

src/main/constants/index.ts

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
export const POWERSHELL_CMD = 'start powershell -noexit -command "[console]::windowwidth=80; [console]::windowheight=35; [console]::bufferwidth=[console]::windowwidth; cd .\\platform-tools; Get-Content -Raw ..\\resources\\assets\\art.txt; Write-Host "Run ADB commands here" -nonewline; Write-Host "`n";Write-Host "Ex: .\\adb COMMAND"; Write-Host "`n""';
1+
import { exec } from 'child_process';
22

3-
export const TERMINAL_CMD = 'open -a Terminal /Applications/"Android Toolkit.app"/Contents/platform-tools';
3+
export const POWERSHELL_CMD = 'start powershell -noexit -command "[console]::windowwidth=80; [console]::windowheight=35; [console]::bufferwidth=[console]::windowwidth; cd .\\platform-tools; Get-Content -Raw ..\\resources\\assets\\art.txt; Write-Host "Run ADB commands here" -nonewline; Write-Host "`n";Write-Host "Ex: .\\adb COMMAND"; Write-Host "`n""';
44

5-
export const SMART_TUBE_URL = 'https://github.com/yuliskov/SmartTube/releases/download/21.54s/SmartTube_stable_21.54_armeabi-v7a.apk';
5+
export const SMART_TUBE_URL = 'https://github.com/yuliskov/SmartTube/releases/download/21.82/SmartTube_beta_21.82_armeabi-v7a.apk';
66

77
export const INFINITY_REDDIT_URL = 'https://github.com/KhoalaS/Infinity-For-Reddit/releases/latest/download/app-release.apk';
88

@@ -37,15 +37,34 @@ export const IS_WIN = process.platform === 'win32';
3737
export const USERNAME= process.env.USERNAME;
3838
export const WINDOWS_RESOURCE_PATH = `C:\\Users\\${USERNAME}\\AppData\\Local\\Programs\\android-toolkit\\resources`;
3939

40+
41+
const getAdbPath = () => {
42+
console.log('using dev adb path');
43+
44+
let path = '';
45+
exec('which adb', (error, stdout, stderr) => {
46+
if (error) {
47+
console.error(`exec error: ${error}`);
48+
console.log(stderr);
49+
return;
50+
}
51+
path = stdout.toString();
52+
});
53+
return path;
54+
};
55+
56+
export const isDevelopment = process.env.NODE_ENV === 'development';
4057
export let APK_PATH: string;
4158
export let ADB_PATH: string;
59+
export let TERMINAL_CMD: string;
4260
export const USER_OS = process.platform;
4361

4462
switch (USER_OS) {
4563
case 'darwin':
4664
console.log('MacOS');
47-
APK_PATH = '/Applications/Android Toolkit.app/Contents/apks/';
48-
ADB_PATH = '/Applications/"Android Toolkit.app"/Contents/platform-tools/';
65+
APK_PATH = isDevelopment ? './apks' : '/Applications/Android Toolkit.app/Contents/apks/';
66+
ADB_PATH = isDevelopment ? getAdbPath() : '/Applications/"Android Toolkit.app"/Contents/platform-tools/';
67+
TERMINAL_CMD = 'open -a Terminal /Applications/"Android Toolkit.app"/Contents/platform-tools';
4968
break;
5069

5170
case 'win32':
@@ -56,8 +75,9 @@ case 'win32':
5675

5776
case 'linux':
5877
console.log('Linux operating system');
59-
APK_PATH = '/usr/bin/Android-Toolkit/apks/';
60-
ADB_PATH = '/usr/bin/Android-Toolkit/platform-tools/';
78+
APK_PATH = isDevelopment ? './apks' : '/usr/bin/Android-Toolkit/apks/';
79+
ADB_PATH = isDevelopment ? getAdbPath() : '/usr/bin/Android-Toolkit/platform-tools/';
80+
TERMINAL_CMD = isDevelopment ? 'x-terminal-emulator' : 'x-terminal-emulator -w /usr/bin/Android-Toolkit/platform-tools/';
6181
break;
6282

6383
default:

0 commit comments

Comments
 (0)