mirror of
https://github.com/Dr-Blank/Vaani.git
synced 2025-12-06 19:19:28 +00:00
This commit is contained in:
parent
2fd4650bb8
commit
edf7b2790f
9 changed files with 141 additions and 189 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:archive/archive_io.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
|
|
@ -28,11 +29,23 @@ class Logs extends _$Logs {
|
|||
}
|
||||
|
||||
Future<String> getZipFilePath() async {
|
||||
final String targetZipPath = await generateZipFilePath();
|
||||
var encoder = ZipFileEncoder();
|
||||
encoder.create(await generateZipFilePath());
|
||||
encoder.addFile(File(await getLoggingFilePath()));
|
||||
encoder.close();
|
||||
return encoder.zipPath;
|
||||
encoder.create(targetZipPath);
|
||||
final logFilePath = await getLoggingFilePath();
|
||||
final logFile = File(logFilePath);
|
||||
if (await logFile.exists()) {
|
||||
// Check if log file exists before adding
|
||||
await encoder.addFile(logFile);
|
||||
} else {
|
||||
// Handle case where log file doesn't exist? Maybe log a warning?
|
||||
// Or create an empty file inside the zip? For now, just don't add.
|
||||
debugPrint(
|
||||
'Warning: Log file not found at $logFilePath, creating potentially empty zip.',
|
||||
);
|
||||
}
|
||||
await encoder.close();
|
||||
return targetZipPath;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ part of 'logs_provider.dart';
|
|||
// RiverpodGenerator
|
||||
// **************************************************************************
|
||||
|
||||
String _$logsHash() => r'901376741d17ddbb889d1b7b96bc2882289720a0';
|
||||
String _$logsHash() => r'aa9d3d56586cba6ddf69615320ea605d071ea5e2';
|
||||
|
||||
/// See also [Logs].
|
||||
@ProviderFor(Logs)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue