Fix up the entire frontend
This commit is contained in:
2193
lib/main.dart
2193
lib/main.dart
File diff suppressed because it is too large
Load Diff
@@ -34,6 +34,7 @@ class ModList {
|
||||
}
|
||||
|
||||
final List<FileSystemEntity> entities = directory.listSync();
|
||||
// TODO: Count only the latest version of each mod and not all versions
|
||||
final List<String> modDirectories =
|
||||
entities.whereType<Directory>().map((dir) => dir.path).toList();
|
||||
|
||||
@@ -85,6 +86,7 @@ class ModList {
|
||||
logger.info(
|
||||
'Loaded mod from directory: ${mod.name} (ID: ${mod.id}) in $modTime ms',
|
||||
);
|
||||
yield mod;
|
||||
} catch (e) {
|
||||
logger.error('Error loading mod from directory: $modDir');
|
||||
logger.error('Error: $e');
|
||||
@@ -171,7 +173,7 @@ class ModList {
|
||||
logger.warning('Mod $modId already exists in mods list, overwriting');
|
||||
}
|
||||
mods[modId] = mod;
|
||||
setEnabled(modId, mod.enabled);
|
||||
setEnabled(modId, true);
|
||||
yield mod;
|
||||
}
|
||||
|
||||
@@ -522,10 +524,10 @@ class ModList {
|
||||
toEnable ??= <String>[];
|
||||
seen ??= <String, bool>{};
|
||||
cyclePath ??= <String>[];
|
||||
|
||||
|
||||
// Add current mod to cycle path
|
||||
cyclePath.add(modId);
|
||||
|
||||
|
||||
for (final dep in mod.dependencies) {
|
||||
if (!mods.containsKey(dep)) {
|
||||
loadOrder.errors.add(
|
||||
@@ -540,7 +542,9 @@ class ModList {
|
||||
if (cycleStart >= 0) {
|
||||
// Extract the cycle part
|
||||
List<String> cycleIds = [...cyclePath.sublist(cycleStart), modId];
|
||||
loadOrder.errors.add('Cyclic dependency detected: ${cycleIds.join(' -> ')}');
|
||||
loadOrder.errors.add(
|
||||
'Cyclic dependency detected: ${cycleIds.join(' -> ')}',
|
||||
);
|
||||
} else {
|
||||
loadOrder.errors.add('Cyclic dependency detected: $modId -> $dep');
|
||||
}
|
||||
@@ -548,9 +552,15 @@ class ModList {
|
||||
}
|
||||
seen[dep] = true;
|
||||
toEnable.add(depMod.id);
|
||||
loadDependencies(depMod.id, loadOrder, toEnable, seen, List.from(cyclePath));
|
||||
loadDependencies(
|
||||
depMod.id,
|
||||
loadOrder,
|
||||
toEnable,
|
||||
seen,
|
||||
List.from(cyclePath),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
return loadOrder;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user