summaryrefslogtreecommitdiff
path: root/lib/simfile.dart
diff options
context:
space:
mode:
authorOrangerot <purple@orangerot.dev>2025-01-07 06:38:34 +0100
committerOrangerot <purple@orangerot.dev>2025-01-07 06:38:34 +0100
commit9c229b94d0aa52679e12e50d62aa8e6cbf9fb9c5 (patch)
treec148c6ee4bbf664be3f1a64f9c9501f00b38edf2 /lib/simfile.dart
parent685323adeab3d27bff4df16a201f9f14688475d5 (diff)
style: refactored searching files into Simfile class
Diffstat (limited to 'lib/simfile.dart')
-rw-r--r--lib/simfile.dart9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/simfile.dart b/lib/simfile.dart
index 764e3aa..7bdf5c0 100644
--- a/lib/simfile.dart
+++ b/lib/simfile.dart
@@ -124,7 +124,8 @@ class Simfile {
simfilePath = Directory(directoryPath)
.listSync()
.firstWhere((entity) => entity.path.endsWith('.sm'),
- orElse: () => File('')).path;
+ orElse: () => File(''))
+ .path;
audioPath = Directory(directoryPath)
.listSync()
@@ -132,6 +133,12 @@ class Simfile {
orElse: () => File(''))
.path;
+ bannerPath = Directory(directoryPath)
+ .listSync()
+ .firstWhere((file) => file.path.toLowerCase().endsWith('banner.png'),
+ orElse: () => File(''))
+ .path;
+
lines = File(simfilePath!).readAsStringSync();
RegExp commentsRegExp = RegExp(r'//.*$');