fix(flutter): create log directory recursively (#1478)

This commit is contained in:
Levi authored and GitHub committed 2026-09-06 13:00:06 +08:00
1 parent 647e161431
commit aafd039205
2 files changed
+40 -4

No files matched your search

+5 -4
View File
@@ -19,14 +19,15 @@ String logsDir() {
return path.join(Util.getStorageDir(), 'logs');
}
Directory ensureLogDirectory(String logDirPath) {
return Directory(logDirPath)..createSync(recursive: true);
}
LogOutput? _buildOutput() {
// if is debug mode, don't log to file
if (!kDebugMode && Util.isDesktop()) {
final logDirPath = logsDir();
var logDir = Directory(logsDir());
if (!logDir.existsSync()) {
logDir.createSync();
}
ensureLogDirectory(logDirPath);
return FileOutput(file: File('$logDirPath/client.log'));
}
return null;