File tree Expand file tree Collapse file tree
lib/project_view/configs/views Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -143,15 +143,27 @@ class _MapConfigViewState extends ConsumerState<MapConfigView> {
143143 ),
144144 onChanged: null ,
145145 onEditingComplete: () => setState (validateAndSaveOptionsThatCannotBeBlank),
146- warningValidator: (String ? value) {
147- if (value == null ) return null ;
148- if (! Directory (value).existsSync ()) {
149- return "Directory does not exist" ;
146+ warningValidator: (String ? worldPath) {
147+ if (worldPath == null ) return null ;
148+
149+ if (! Directory (worldPath).existsSync ()) return "Directory does not exist" ;
150+
151+ if (File (p.join (worldPath, "level.dat" )).existsSync ()) return null ;
152+ if (Directory (p.join (worldPath, "region" )).existsSync ()) return null ;
153+
154+ final dimsDir = Directory (p.join (worldPath, "dimensions" ));
155+ if (dimsDir.existsSync ()) {
156+ for (final FileSystemEntity namespaceFSE in dimsDir.listSync ()) {
157+ if (namespaceFSE is ! Directory ) continue ;
158+ for (final FileSystemEntity dimensionFSE in namespaceFSE.listSync ()) {
159+ if (Directory (p.join (dimensionFSE.path, "region" )).existsSync ()) {
160+ return null ;
161+ }
162+ }
163+ }
150164 }
151- if (! Directory (p.join (value, "region" )).existsSync ()) {
152- return "Directory does not seem to contain a Minecraft World" ;
153- }
154- return null ;
165+
166+ return "Directory does not seem to contain a Minecraft World" ;
155167 },
156168 ),
157169 TextFieldOption .customDescription (
You can’t perform that action at this time.
0 commit comments