@@ -45,6 +45,7 @@ static func _get_json_string_as_dict(string: String) -> Dictionary:
45
45
46
46
# Load the mod ZIP from the provided directory
47
47
static 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"
48
49
var zip_data := {}
49
50
50
51
var mod_dir := Directory .new ()
@@ -85,13 +86,23 @@ static func load_zips_in_folder(folder_path: String) -> Dictionary:
85
86
# Get the current directories inside UNPACKED_DIR
86
87
# This array is used to determine which directory is new
87
88
var current_mod_dirs := _ModLoaderPath .get_dir_paths_in_dir (_ModLoaderPath .get_unpacked_mods_dir_path ())
89
+
88
90
# Create a backup to reference when the next mod is loaded
89
91
var current_mod_dirs_backup := current_mod_dirs .duplicate ()
90
92
91
93
# Remove all directory paths that existed before, leaving only the one added last
92
94
for previous_mod_dir in ModLoaderStore .previous_mod_dirs :
93
95
current_mod_dirs .erase (previous_mod_dir )
94
96
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
+
95
106
# The key is the mod_id of the latest loaded mod, and the value is the path to the zip file
96
107
zip_data [current_mod_dirs [0 ].get_slice ("/" , 3 )] = mod_zip_global_path
97
108
0 commit comments