Skip to content

Commit a8b2239

Browse files
authored
fix: 🐛 wrong UNPACKED_DIR reference (#234)
* fix: 🐛 wrong `UNPACKED_DIR` reference * refactor: ♻️ use `_ModLoaderPath.get_unpacked_mods_dir_path()` * style: 🔥 removed no longer accurate comment
1 parent 60d4f3a commit a8b2239

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

addons/mod_loader/api/profile.gd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ static func _update_mod_lists() -> bool:
194194
# Delete no longer installed mods
195195
for mod_id in profile.mod_list:
196196
# Check if the mod_dir for the mod-id exists
197-
if not _ModLoaderFile.dir_exists(ModLoader.UNPACKED_DIR + mod_id):
197+
if not _ModLoaderFile.dir_exists(_ModLoaderPath.get_unpacked_mods_dir_path() + mod_id):
198198
# if not the mod is no longer installed and can be removed
199199
profile.mod_list.erase(mod_id)
200200

addons/mod_loader/internal/script_extension.gd

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ const LOG_NAME := "ModLoader:ScriptExtension"
1010

1111
# Couple the extension paths with the parent paths and the extension's mod id
1212
# in a ScriptExtensionData resource
13-
# We need to pass the UNPACKED_DIR constant because the global ModLoader is not available during _init().
1413
static func handle_script_extensions() -> void:
1514
var script_extension_data_array := []
1615
for extension_path in ModLoaderStore.script_extensions:
@@ -21,7 +20,7 @@ static func handle_script_extensions() -> void:
2120

2221
var child_script = ResourceLoader.load(extension_path)
2322

24-
var mod_id: String = extension_path.trim_prefix(ModLoaderStore.UNPACKED_DIR).get_slice("/", 0)
23+
var mod_id: String = extension_path.trim_prefix(_ModLoaderPath.get_unpacked_mods_dir_path()).get_slice("/", 0)
2524

2625
var parent_script: Script = child_script.get_base_script()
2726
var parent_script_path: String = parent_script.resource_path

addons/mod_loader/mod_loader.gd

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,8 @@ func _load_zips_in_folder(folder_path: String) -> int:
255255
if OS.has_feature("editor") and not ModLoaderStore.has_shown_editor_zips_warning:
256256
ModLoaderLog.warning(str(
257257
"Loading any resource packs (.zip/.pck) with `load_resource_pack` will WIPE the entire virtual res:// directory. ",
258-
"If you have any unpacked mods in ", ModLoaderStore.UNPACKED_DIR, ", they will not be loaded. ",
259-
"Please unpack your mod ZIPs instead, and add them to ", ModLoaderStore.UNPACKED_DIR), LOG_NAME)
258+
"If you have any unpacked mods in ", _ModLoaderPath.get_unpacked_mods_dir_path(), ", they will not be loaded. ",
259+
"Please unpack your mod ZIPs instead, and add them to ", _ModLoaderPath.get_unpacked_mods_dir_path()), LOG_NAME)
260260
ModLoaderStore.has_shown_editor_zips_warning = true
261261

262262
ModLoaderLog.debug("Found mod ZIP: %s" % mod_folder_global_path, LOG_NAME)
@@ -323,7 +323,7 @@ func _load_steam_workshop_zips() -> int:
323323
# which adds their data to mod_data.
324324
func _setup_mods() -> int:
325325
# Path to the unpacked mods folder
326-
var unpacked_mods_path := ModLoaderStore.UNPACKED_DIR
326+
var unpacked_mods_path := _ModLoaderPath.get_unpacked_mods_dir_path()
327327

328328
var dir := Directory.new()
329329
if not dir.open(unpacked_mods_path) == OK:
@@ -413,7 +413,7 @@ func _init_mod_data(mod_folder_path: String) -> void:
413413
var dir_name := _ModLoaderPath.get_file_name_from_path(mod_folder_path, false, true)
414414

415415
# Path to the mod in UNPACKED_DIR (eg "res://mods-unpacked/My-Mod")
416-
var local_mod_path := ModLoaderStore.UNPACKED_DIR.plus_file(dir_name)
416+
var local_mod_path := _ModLoaderPath.get_unpacked_mods_dir_path().plus_file(dir_name)
417417

418418
var mod := ModData.new(local_mod_path)
419419
mod.dir_name = dir_name

0 commit comments

Comments
 (0)