Skip to content

Commit fcb1f4d

Browse files
authored
refactor: ✏️ changed config dir to "user://mod_configs" (#480)
refactor: ✏️ changed `MOD_CONFIG_DIR_PATH` to "user://mod_configs" from "user://configs" closes #442
1 parent 3a88966 commit fcb1f4d

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

addons/mod_loader/internal/path.gd

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ extends RefCounted
66
# Currently all of the included functions are internal and should only be used by the mod loader itself.
77

88
const LOG_NAME := "ModLoader:Path"
9-
const MOD_CONFIG_DIR_PATH := "user://configs"
9+
const MOD_CONFIG_DIR_PATH := "user://mod_configs"
10+
const MOD_CONFIG_DIR_PATH_OLD := "user://configs"
1011

1112

1213
# Get the path to a local folder. Primarily used to get the (packed) mods
@@ -178,6 +179,8 @@ static func get_unpacked_mods_dir_path() -> String:
178179

179180
# Get the path to the configs folder, with any applicable overrides applied
180181
static func get_path_to_configs() -> String:
182+
if _ModLoaderFile.dir_exists(MOD_CONFIG_DIR_PATH_OLD):
183+
handle_mod_config_path_deprecation()
181184
var configs_path := MOD_CONFIG_DIR_PATH
182185
if ModLoaderStore:
183186
if ModLoaderStore.ml_options.override_path_to_configs:
@@ -229,3 +232,13 @@ static func get_mod_dir(path: String) -> String:
229232
var found_string: String = path.substr(start_index, end_index - start_index)
230233

231234
return found_string
235+
236+
237+
static func handle_mod_config_path_deprecation() -> void:
238+
ModLoaderDeprecated.deprecated_message("The mod config path has been moved to \"%s\".
239+
The Mod Loader will attempt to rename the config directory." % MOD_CONFIG_DIR_PATH, "7.0.0")
240+
var error := DirAccess.rename_absolute(MOD_CONFIG_DIR_PATH_OLD, MOD_CONFIG_DIR_PATH)
241+
if not error == OK:
242+
ModLoaderLog.error("Failed to rename the config directory with error \"%s\"." % [error_string(error)], LOG_NAME)
243+
else:
244+
ModLoaderLog.success("Successfully renamed config directory to \"%s\"." % MOD_CONFIG_DIR_PATH, LOG_NAME)

0 commit comments

Comments
 (0)