|
@@ -25,7 +25,7 @@ Future downloadLatestClashCore() async {
|
|
.firstWhere((it) => (it['name'] as String).contains(clashCoreName));
|
|
.firstWhere((it) => (it['name'] as String).contains(clashCoreName));
|
|
final String downloadUrl = latest['browser_download_url'];
|
|
final String downloadUrl = latest['browser_download_url'];
|
|
|
|
|
|
- final String newName = 'clash-${ClashName.platform}-${ClashName.arch}';
|
|
|
|
|
|
+ //final String newName = 'clash-${ClashName.platform}-${ClashName.arch}';
|
|
final String name = clashCoreName;
|
|
final String name = clashCoreName;
|
|
final tempFile = File(path.join(binDir.path, '$name.temp'));
|
|
final tempFile = File(path.join(binDir.path, '$name.temp'));
|
|
|
|
|
|
@@ -37,12 +37,12 @@ Future downloadLatestClashCore() async {
|
|
final tempBetys = await tempFile.readAsBytes();
|
|
final tempBetys = await tempFile.readAsBytes();
|
|
if (name.contains('.gz')) {
|
|
if (name.contains('.gz')) {
|
|
final bytes = GZipDecoder().decodeBytes(tempBetys);
|
|
final bytes = GZipDecoder().decodeBytes(tempBetys);
|
|
- final String filePath = path.join(binDir.path, newName);
|
|
|
|
|
|
+ final String filePath = path.join(binDir.path, ClashName.name);
|
|
await File(filePath).writeAsBytes(bytes);
|
|
await File(filePath).writeAsBytes(bytes);
|
|
await Process.run('chmod', ['+x', filePath]);
|
|
await Process.run('chmod', ['+x', filePath]);
|
|
} else {
|
|
} else {
|
|
final file = ZipDecoder().decodeBytes(tempBetys).first;
|
|
final file = ZipDecoder().decodeBytes(tempBetys).first;
|
|
- await File(path.join(binDir.path, newName)).writeAsBytes(file.content);
|
|
|
|
|
|
+ await File(path.join(binDir.path, ClashName.name)).writeAsBytes(file.content);
|
|
}
|
|
}
|
|
await tempFile.delete();
|
|
await tempFile.delete();
|
|
print('Unarchiv Success');
|
|
print('Unarchiv Success');
|