|
@@ -4,7 +4,6 @@ import 'dart:io';
|
|
|
import 'package:dio/dio.dart';
|
|
|
import 'package:archive/archive.dart';
|
|
|
import 'package:naiyouwl/app/const/const.dart';
|
|
|
-import 'package:naiyouwl/app/const/const.dart';
|
|
|
import 'package:path/path.dart' as path;
|
|
|
|
|
|
final dio = Dio();
|
|
@@ -16,7 +15,7 @@ final depDir = Directory(path.join(assetsPath, 'dep'));
|
|
|
|
|
|
Future downloadLatestClashCore() async {
|
|
|
const version = "v1.16.0";
|
|
|
- final String clashCoreName = 'clash.meta-${ClashName.platform}-$arch-cgo-$version';
|
|
|
+ final String clashCoreName = 'clash.meta-${ClashName.platform}-${ClashName.arch}-cgo-$version';
|
|
|
|
|
|
|
|
|
final info = await dio.get('https://api.github.com/repos/MetaCubeX/Clash.Meta/releases/tags/$version');
|
|
@@ -50,7 +49,7 @@ Future downloadLatestClashCore() async {
|
|
|
Future<void> downloadAndUnarchiveService() async {
|
|
|
|
|
|
|
|
|
- final serviceName = 'ccore-service-${ClashName.platform}-$arch';
|
|
|
+ final serviceName = 'ccore-service-${ClashName.platform}-${ClashName.arch}';
|
|
|
|
|
|
|
|
|
|
|
@@ -92,7 +91,7 @@ Future<void> downloadAndUnarchiveService() async {
|
|
|
}
|
|
|
|
|
|
Future downloadLatestClashService() async {
|
|
|
- final String serviceName = 'ccore-service-${ClashName.platform}-$arch';
|
|
|
+ final String serviceName = 'ccore-service-${ClashName.platform}-${ClashName.arch}';
|
|
|
|
|
|
|
|
|
|
|
@@ -145,7 +144,7 @@ Future downloadWintun() async {
|
|
|
print('Download Success');
|
|
|
print('Unarchiving wintun.zip');
|
|
|
final files = ZipDecoder().decodeBytes(await wintunFile.readAsBytes());
|
|
|
- final file = files.firstWhere((it) => it.name == 'wintun/bin/$arch/wintun.dll');
|
|
|
+ final file = files.firstWhere((it) => it.name == 'wintun/bin/${ClashName.arch}/wintun.dll');
|
|
|
await File(path.join(depDir.path, 'wintun.dll')).writeAsBytes(file.content);
|
|
|
await wintunFile.delete();
|
|
|
print('Unarchiv Success');
|