Skip to content

Commit 78dda5f

Browse files
committed
Show error when missing having at least one Split Image instead of only when folder is empty.
+ Detect Split Folder with only hidden files as being empty
1 parent 5ca2273 commit 78dda5f

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

src/error_messages.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ def invalid_directory(directory: str):
5858
set_text_message(f"Folder {directory!r} is invalid or does not exist.")
5959

6060

61-
def split_image_directory_empty():
62-
set_text_message("The Split Image Folder is empty.")
61+
def no_split_image():
62+
set_text_message("Your Split Image Folder should contain at least one Split Image.")
6363

6464

6565
def image_type(image: str):
@@ -82,7 +82,7 @@ def split_hotkey():
8282

8383
def pause_hotkey():
8484
set_text_message(
85-
"Your split image folder contains an image filename with a pause flag {p}, "
85+
"Your Split Image Folder contains an image filename with a pause flag {p}, "
8686
+ "but no pause hotkey is set."
8787
)
8888

@@ -97,7 +97,7 @@ def alignment_not_matched():
9797

9898
def no_keyword_image(keyword: str):
9999
set_text_message(
100-
f"Your split image folder does not contain an image with the keyword {keyword!r}."
100+
f"Your Split Image Folder does not contain an image with the keyword {keyword!r}."
101101
)
102102

103103

@@ -106,7 +106,7 @@ def multiple_keyword_images(keyword: str):
106106

107107

108108
def reset_hotkey():
109-
set_text_message("Your split image folder contains a Reset Image, but no reset hotkey is set.")
109+
set_text_message("Your Split Image Folder contains a Reset Image, but no reset hotkey is set.")
110110

111111

112112
def old_version_settings_file():

src/split_parser.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,6 @@ def validate_before_parsing(autosplit: "AutoSplit", *, show_error: bool = True):
192192
error = error_messages.split_image_directory
193193
elif not os.path.isdir(split_image_directory):
194194
error = partial(error_messages.invalid_directory, split_image_directory)
195-
elif not os.listdir(split_image_directory):
196-
error = error_messages.split_image_directory_empty
197195
elif not autosplit.capture_method.check_selected_region_exists():
198196
error = error_messages.region
199197
if error and show_error:
@@ -241,9 +239,12 @@ def parse_and_validate_images(autosplit: "AutoSplit"):
241239

242240
error_message: Callable[[], object] | None = None
243241

242+
if not split_images:
243+
error_message = error_messages.no_split_image
244+
244245
# If there is no start hotkey set but a Start Image is present,
245246
# and is not auto controlled, throw an error.
246-
if (
247+
elif (
247248
start_image
248249
and not autosplit.settings_dict["split_hotkey"]
249250
and not autosplit.is_auto_controlled

0 commit comments

Comments
 (0)