diff --git a/lib/background/wemFilesIndexer.dart b/lib/background/wemFilesIndexer.dart index 0c3bfa15..2646dbfd 100644 --- a/lib/background/wemFilesIndexer.dart +++ b/lib/background/wemFilesIndexer.dart @@ -37,9 +37,9 @@ class WemFilesLookup { if (await Directory(dataPath).exists()) { await _indexDir(dataPath, recursive: false); } - } catch (e) { + } catch (e, s) { print("Error indexing WAI files:"); - print(e); + print("$e\n$s"); } loadingCompleter!.complete(); diff --git a/lib/fileTypeUtils/audio/audioModsChangesUndo.dart b/lib/fileTypeUtils/audio/audioModsChangesUndo.dart index bb00874c..cf774174 100644 --- a/lib/fileTypeUtils/audio/audioModsChangesUndo.dart +++ b/lib/fileTypeUtils/audio/audioModsChangesUndo.dart @@ -90,9 +90,9 @@ Future revertAllAudioMods(String waiPath) async { await File(changedFile).delete(); await File(backupPath).rename(changedFile); restoreCount++; - } catch (e) { + } catch (e, s) { messageLog.add("Failed to restore $changedFile"); - print(e); + print("$e\n$s"); warningCount++; } } diff --git a/lib/fileTypeUtils/audio/modInstaller.dart b/lib/fileTypeUtils/audio/modInstaller.dart index 451c53a6..5398604f 100644 --- a/lib/fileTypeUtils/audio/modInstaller.dart +++ b/lib/fileTypeUtils/audio/modInstaller.dart @@ -5,7 +5,6 @@ import 'package:archive/archive_io.dart'; import 'package:file_picker/file_picker.dart'; import 'package:path/path.dart'; -import '../../stateManagement/events/statusInfo.dart'; import '../../stateManagement/preferencesData.dart'; import '../../utils/utils.dart'; import '../utils/ByteDataWrapper.dart'; @@ -64,7 +63,6 @@ Future installMod(String waiPath) async { } showToast("Mod installed successfully :)"); - messageLog.add("Mod installed successfully :)"); } catch (e) { // restore original files for (var file in changedFiles) { diff --git a/lib/fileTypeUtils/dat/datExtractor.dart b/lib/fileTypeUtils/dat/datExtractor.dart index 74e796c4..6e1d77f6 100644 --- a/lib/fileTypeUtils/dat/datExtractor.dart +++ b/lib/fileTypeUtils/dat/datExtractor.dart @@ -125,8 +125,9 @@ Stream extractDatFilesAsStream(String datPath) async* { bytes.makeSubView(fileSizes[i]) ); } - } catch (e) { + } catch (e, s) { print("Error while extracting dat files from $datPath"); + print("$e\n$s"); return; } } diff --git a/lib/fileTypeUtils/textures/fontAtlasGenerator.dart b/lib/fileTypeUtils/textures/fontAtlasGenerator.dart index be043c1d..e6f1c4c1 100644 --- a/lib/fileTypeUtils/textures/fontAtlasGenerator.dart +++ b/lib/fileTypeUtils/textures/fontAtlasGenerator.dart @@ -31,9 +31,9 @@ Future runFontAtlasGenerator(FontAtlasGenCliOptions options) try { var atlasInfoJson = jsonDecode(await stdout); return FontAtlasGenResult.fromJson(atlasInfoJson); - } catch (e) { + } catch (e, s) { showToast("Font atlas generator failed"); - print(e); + print("$e\n$s"); print(await stdout); print(await stderr); throw Exception("Font atlas generator failed"); diff --git a/lib/stateManagement/beforeExitCleanup.dart b/lib/stateManagement/beforeExitCleanup.dart index 1684cde1..acae76da 100644 --- a/lib/stateManagement/beforeExitCleanup.dart +++ b/lib/stateManagement/beforeExitCleanup.dart @@ -25,8 +25,8 @@ Future beforeExitConfirmation() async { try { await beforeExitCleanup(); - } catch (e) { - print(e); + } catch (e, s) { + print("$e\n$s"); } return true; diff --git a/lib/stateManagement/hierarchy/FileHierarchy.dart b/lib/stateManagement/hierarchy/FileHierarchy.dart index f2ae87e2..7e19775e 100644 --- a/lib/stateManagement/hierarchy/FileHierarchy.dart +++ b/lib/stateManagement/hierarchy/FileHierarchy.dart @@ -65,7 +65,7 @@ class OpenHierarchyManager with HasUuid, Undoable, HierarchyEntryBase implements children.addListener(() => filteredTreeIsDirty.value = true); _onSearchChangedThrottled = debounce(() => filteredTreeIsDirty.value = true, 500); search.addListener(() { - var (overThreshold, count) = hasOverXChildren(500*1000); + var (overThreshold, _) = hasOverXChildren(500*1000); if (overThreshold) _onSearchChangedThrottled(); else @@ -199,8 +199,8 @@ class OpenHierarchyManager with HasUuid, Undoable, HierarchyEntryBase implements else { try { datFilePaths = await getDatFileList(datExtractDir); - } catch (e) { - print(e); + } catch (e, s) { + print("$e\n$s"); } //check if extracted folder actually contains all dat files if (datFilePaths == null || await Future.any(datFilePaths.map((name) async => !await File(name).exists()))) { diff --git a/lib/stateManagement/openFiles/filesAreaManager.dart b/lib/stateManagement/openFiles/filesAreaManager.dart index 74169abe..d4a8edf5 100644 --- a/lib/stateManagement/openFiles/filesAreaManager.dart +++ b/lib/stateManagement/openFiles/filesAreaManager.dart @@ -176,8 +176,9 @@ class FilesAreaManager with HasUuid, Undoable implements Disposable { await Future.wait( files.where((file) => file.hasUnsavedChanges.value) .map((file) => file.save())); - } catch (e) { + } catch (e, s) { print("Error while saving all files"); + print("$e\n$s"); rethrow; } } diff --git a/lib/stateManagement/openFiles/openFilesManager.dart b/lib/stateManagement/openFiles/openFilesManager.dart index 41438fb2..309c4041 100644 --- a/lib/stateManagement/openFiles/openFilesManager.dart +++ b/lib/stateManagement/openFiles/openFilesManager.dart @@ -259,8 +259,9 @@ class OpenFilesAreasManager with HasUuid, Undoable implements Disposable { ]); onSaveAll.notifyListeners(); await processChangedFiles(); - } catch (e) { + } catch (e, s) { showToast("Error saving files"); + print("$e\n$s"); rethrow; } finally { isLoadingStatus.popIsLoading(); diff --git a/lib/stateManagement/openFiles/types/FtbFileData.dart b/lib/stateManagement/openFiles/types/FtbFileData.dart index c51cb221..583f44fb 100644 --- a/lib/stateManagement/openFiles/types/FtbFileData.dart +++ b/lib/stateManagement/openFiles/types/FtbFileData.dart @@ -57,8 +57,9 @@ class FtbFileData extends OpenFileData { var bytes = await ByteDataWrapper.fromFile(fontPath); var ttf = TtfFile.read(bytes); fontChars = ttf.allChars(); - } catch (e) { + } catch (e, s) { showToast("Failed to read font file"); + print("$e\n$s"); rethrow; } ftbData!.pendingNewChars.clear(); diff --git a/lib/stateManagement/openFiles/types/McdFileData.dart b/lib/stateManagement/openFiles/types/McdFileData.dart index a095762f..1ffa5626 100644 --- a/lib/stateManagement/openFiles/types/McdFileData.dart +++ b/lib/stateManagement/openFiles/types/McdFileData.dart @@ -607,9 +607,9 @@ class McdData extends _McdFilePart { try { textureSize = await getImageSize(wtpPath); } - catch (e) { + catch (e, s) { showToast("Unable to read ${basename(wtpPath)} file!"); - print(e); + print("$e\n$s"); throw Exception("Unable to read $wtpPath"); } diff --git a/lib/stateManagement/openFiles/types/TextFileData.dart b/lib/stateManagement/openFiles/types/TextFileData.dart index a65ce11c..189f1296 100644 --- a/lib/stateManagement/openFiles/types/TextFileData.dart +++ b/lib/stateManagement/openFiles/types/TextFileData.dart @@ -24,9 +24,9 @@ class TextFileData extends OpenFileData { loadingState.value = LoadingState.loading; try { text.value = await File(path).readAsString(); - } catch (e) { + } catch (e, s) { text.value = "[Error loading file]"; - print(e); + print("$e\n$s"); } await super.load(); } diff --git a/lib/utils/assetDirFinder.dart b/lib/utils/assetDirFinder.dart index f19352cf..976b1fdf 100644 --- a/lib/utils/assetDirFinder.dart +++ b/lib/utils/assetDirFinder.dart @@ -127,9 +127,9 @@ Future checkPythonVersion(String cmd) async { return false; return true; - } catch (e) { + } catch (e, s) { print("Error checking python version"); - print(e); + print("$e\n$s"); return false; } } diff --git a/lib/widgets/filesView/types/fonts/fontOverridesApply.dart b/lib/widgets/filesView/types/fonts/fontOverridesApply.dart index 76ef7474..5e1b3b5e 100644 --- a/lib/widgets/filesView/types/fonts/fontOverridesApply.dart +++ b/lib/widgets/filesView/types/fonts/fontOverridesApply.dart @@ -22,9 +22,9 @@ class FontOverridesApplyButton extends StatelessWidget { .where((file) => file is McdFileData || file is FtbFileData); await Future.wait(savableFiles.map((f) => f.save())); messageLog.add("Done :>"); - } catch (e) { + } catch (e, s) { messageLog.add("Error :/"); - print(e); + print("$e\n$s"); } finally { await processChangedFiles(); isLoadingStatus.popIsLoading(); diff --git a/lib/widgets/filesView/types/fonts/mcdEditor.dart b/lib/widgets/filesView/types/fonts/mcdEditor.dart index ff38bc25..f593bb09 100644 --- a/lib/widgets/filesView/types/fonts/mcdEditor.dart +++ b/lib/widgets/filesView/types/fonts/mcdEditor.dart @@ -79,11 +79,10 @@ class _McdEditorState extends ChangeNotifierState { children: widget.file.loadingState.value == LoadingState.loaded ? [ _McdEditorBody(file: widget.file, mcd: widget.file.mcdData!), FontsManager(mcd: widget.file.mcdData!), - if (widget.file.mcdData!.textureWtpPath != null) - McdFontDebugger( - texturePath: widget.file.mcdData!.textureWtpPath!.value, - fonts: widget.file.mcdData!.usedFonts.values.toList(), - ), + McdFontDebugger( + texturePath: widget.file.mcdData!.textureWtpPath.value, + fonts: widget.file.mcdData!.usedFonts.values.toList(), + ), ] : List.filled(3, loadingIndicator), ), ), diff --git a/lib/widgets/filesView/types/genericTable/tableExporter.dart b/lib/widgets/filesView/types/genericTable/tableExporter.dart index ed3103e2..9ad7d82c 100644 --- a/lib/widgets/filesView/types/genericTable/tableExporter.dart +++ b/lib/widgets/filesView/types/genericTable/tableExporter.dart @@ -81,8 +81,8 @@ Future loadTableFromJson(CustomTableConfig tableConfig) async { for (int i = 0; i < table.length; i++) { tableConfig.updateRowWith(i, table[i]); } - } catch (e) { - print(e); + } catch (e, s) { + print("$e\n$s"); showToast("Failed to load table from JSON"); } } @@ -105,8 +105,8 @@ Future loadTableFromCsv(CustomTableConfig tableConfig) async { for (int i = 0; i < table.length; i++) { tableConfig.updateRowWith(i, table[i]); } - } catch (e) { - print(e); + } catch (e, s) { + print("$e\n$s"); showToast("Failed to load table from CSV"); } }