Skip to content

Commit

Permalink
Add try-catch
Browse files Browse the repository at this point in the history
  • Loading branch information
TaYaKi71751 committed Jan 8, 2025
1 parent 926322d commit 9227eb2
Showing 1 changed file with 40 additions and 34 deletions.
74 changes: 40 additions & 34 deletions lib/util/mod/ModList.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,49 +6,55 @@ class ModList {
static List<Mod> get all {
List<Mod> rtn = List.empty(growable: true);
for (FileSystemEntity entity in Directory.current.listSync()) {
if (File(entity.path).existsSync()) {
var m = Mod(entity.path);
if (m.isMod == true) {
rtn.add(m);
try {
if (File(entity.path).existsSync()) {
var m = Mod(entity.path);
if (m.isMod == true) {
rtn.add(m);
}
}
}
List<String> dpath = entity.path.split(Platform.pathSeparator);
dpath = (dpath.join(Platform.pathSeparator).replaceAll(Platform.pathSeparator + 'Disabled', '').replaceAll(Directory.current.path, Directory.current.path + Platform.pathSeparator + 'Disabled')).split(Platform.pathSeparator);
if(Directory(dpath.join(Platform.pathSeparator)).existsSync()){
print(dpath);
for (FileSystemEntity entity2 in Directory(dpath.join(Platform.pathSeparator)).listSync()) {
print(entity2.path);
for (FileSystemEntity entity3 in Directory(entity2.path).listSync()) {
var m = Mod(entity3.path);
if (m.isMod == true) {
rtn.add(m);
}
}
var m = Mod(entity2.path);
if (m.isMod == true) {
rtn.add(m);
}
}
}
if (Directory(entity.path).existsSync()) {
try {
for (FileSystemEntity entity2 in Directory(entity.path).listSync()) {
try {
for(FileSystemEntity entity3 in Directory(entity2.path).listSync()){
var m = Mod(entity3.path);
} catch (e) {}
List<String> dpath = entity.path.split(Platform.pathSeparator);
dpath = (dpath
.join(Platform.pathSeparator)
.replaceAll(Platform.pathSeparator + 'Disabled', '')
.replaceAll(Directory.current.path,
Directory.current.path + Platform.pathSeparator + 'Disabled'))
.split(Platform.pathSeparator);
if (Directory(dpath.join(Platform.pathSeparator)).existsSync()) {
for (FileSystemEntity entity2
in Directory(dpath.join(Platform.pathSeparator)).listSync()) {
try {
for (FileSystemEntity entity3
in Directory(entity2.path).listSync()) {
var m = Mod(entity3.path);
if (m.isMod == true) {
rtn.add(m);
}
}
} catch (e) {}
var m = Mod(entity2.path);
if (m.isMod == true) {
rtn.add(m);
}

}
} catch (e){}
}
}
if (Directory(entity.path).existsSync()) {
for (FileSystemEntity entity2 in Directory(entity.path).listSync()) {
try {
for (FileSystemEntity entity3
in Directory(entity2.path).listSync()) {
var m = Mod(entity3.path);
if (m.isMod == true) {
rtn.add(m);
}
}
} catch (e) {}
var m = Mod(entity2.path);
if (m.isMod == true) {
rtn.add(m);
}

}
}catch(e){}
}
}
return rtn;
Expand Down

0 comments on commit 9227eb2

Please sign in to comment.