@@ -45,6 +45,7 @@ static func _get_json_string_as_dict(string: String) -> Dictionary:
4545
4646# Load the mod ZIP from the provided directory
4747static func load_zips_in_folder (folder_path : String ) -> Dictionary :
48+ var URL_MOD_STRUCTURE_DOCS := "https://github.com/GodotModding/godot-mod-loader/wiki/Mod-Structure"
4849 var zip_data := {}
4950
5051 var mod_dir := Directory .new ()
@@ -85,13 +86,23 @@ static func load_zips_in_folder(folder_path: String) -> Dictionary:
8586 # Get the current directories inside UNPACKED_DIR
8687 # This array is used to determine which directory is new
8788 var current_mod_dirs := _ModLoaderPath .get_dir_paths_in_dir (_ModLoaderPath .get_unpacked_mods_dir_path ())
89+
8890 # Create a backup to reference when the next mod is loaded
8991 var current_mod_dirs_backup := current_mod_dirs .duplicate ()
9092
9193 # Remove all directory paths that existed before, leaving only the one added last
9294 for previous_mod_dir in ModLoaderStore .previous_mod_dirs :
9395 current_mod_dirs .erase (previous_mod_dir )
9496
97+ # If the mod zip is not structured correctly, it may not be in the UNPACKED_DIR.
98+ if current_mod_dirs .empty ():
99+ ModLoaderLog .fatal (
100+ "The mod zip at path \" %s \" does not have the correct file structure. For more information, please visit \" %s \" ."
101+ % [mod_zip_global_path , URL_MOD_STRUCTURE_DOCS ],
102+ LOG_NAME
103+ )
104+ continue
105+
95106 # The key is the mod_id of the latest loaded mod, and the value is the path to the zip file
96107 zip_data [current_mod_dirs [0 ].get_slice ("/" , 3 )] = mod_zip_global_path
97108
0 commit comments