Build native Flutter Linux manager and deb release 0.2.5

This commit is contained in:
tongtong committed 2026-11-13 19:28:09 +08:00
1 parent 3c6c4a0e90
commit 03e729a60b
35 files changed
+757 -69

No files matched your search

+37
View File
@@ -0,0 +1,37 @@
import 'dart:io';
import 'package:path/path.dart' as p;
/// Stable per-user locations, independent of the installed bundle and cwd.
class AppPaths {
static String configuration({
Map<String, String>? environment,
bool? windows,
}) {
final env = environment ?? Platform.environment;
final isWindows = windows ?? Platform.isWindows;
final paths = p.Context(style: isWindows ? p.Style.windows : p.Style.posix);
final home = env['HOME'] ?? env['USERPROFILE'] ?? Directory.systemTemp.path;
return isWindows
? paths.join(env['LOCALAPPDATA'] ?? home, 'TTSTD', 'ADS-Flutter')
: paths.join(
env['XDG_CONFIG_HOME'] ?? paths.join(home, '.config'),
'ads-flutter',
);
}
static String logs({Map<String, String>? environment, bool? windows}) {
final env = environment ?? Platform.environment;
final isWindows = windows ?? Platform.isWindows;
if (isWindows) {
return p.Context(style: p.Style.windows)
.join(configuration(environment: env, windows: true), 'logs');
}
final home = env['HOME'] ?? Directory.systemTemp.path;
return p.posix.join(
env['XDG_STATE_HOME'] ?? p.posix.join(home, '.local', 'state'),
'ads-flutter',
'logs',
);
}
}
@@ -7,6 +7,7 @@ import 'package:path/path.dart' as p;
import 'windows_usb.dart';
import 'usb_recovery.dart';
import 'tool_paths.dart';
import 'app_paths.dart';
class Settings {
String server = 'wss://ttstd.com/ads';
@@ -100,13 +101,7 @@ class ManagerRepository {
ManagerRepository(this.log, {this.paths});
Future<void> init() async {
storage = Directory(
p.join(
Platform.environment['LOCALAPPDATA'] ?? Directory.systemTemp.path,
'TTSTD',
'ADS-Flutter',
),
);
storage = Directory(AppPaths.configuration());
await storage.create(recursive: true);
for (final start in [
Directory.current.path,
@@ -140,6 +135,7 @@ class ManagerRepository {
jsonDecode(await saved.readAsString()) as Map<String, dynamic>,
);
}
if (!Platform.isWindows) settings.usbMode = false;
await repairToolPaths();
token = Platform.environment['ADS_CLIENT_TOKEN'] ?? '';
if (token.isEmpty && await File(settings.credential).exists()) {
@@ -354,6 +350,9 @@ class ManagerRepository {
configured: settings.adb,
required: true,
);
if (settings.usbMode && !Platform.isWindows) {
throw UnsupportedError("Linux 桌面端请使用网络 ADB;USB 模拟可使用 ads-usb CLI。");
}
final usbMode = settings.usbMode;
final usbip = settings.usbip;
if (usbMode) {
@@ -626,6 +625,7 @@ class ManagerRepository {
}
Future<void> screen(Session s, {bool embedded = false}) async {
embedded = embedded && Platform.isWindows;
if (s.stopping) {
return;
}