Skip to content

Commit 53ecec5

Browse files
committed
Corrected false indentation and error
1 parent 9aec3be commit 53ecec5

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

addons/mod_loader/api/profile.gd

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ static func rename_profile(old_profile_name: String, new_profile_name: String) -
106106
if not ModLoaderStore.user_profiles.has(old_profile_name):
107107
ModLoaderLog.error("User profile with the name of \"%s\" does not exist." % old_profile_name, LOG_NAME)
108108
return false
109+
<<<<<<< HEAD
109110

110111
# Verify that the new profile_name is not already in use
111112
if ModLoaderStore.user_profiles.has(new_profile_name):
@@ -123,6 +124,25 @@ static func rename_profile(old_profile_name: String, new_profile_name: String) -
123124
# Set it as the current profile
124125
if ModLoaderStore.current_user_profile == old_profile_name:
125126
ModLoaderStore.current_user_profile = new_profile_name
127+
=======
128+
129+
# Verify that the new profile_name is not already in use
130+
if ModLoaderStore.user_profiles.has(new_profile_name):
131+
ModLoaderLog.error("User profile with the name of \"%s\" already exists." % new_profile_name, LOG_NAME)
132+
return false
133+
134+
# Rename user profile
135+
var profile_to_rename = ModLoaderStore.user_profiles[old_profile_name].duplicate(true)
136+
profile_to_rename.name = new_profile_name
137+
138+
# Remove old profile entry, replace it with new name entry in the ModLoaderStore
139+
ModLoaderStore.user_profiles.erase(old_profile_name)
140+
ModLoaderStore.user_profiles[new_profile_name] = profile_to_rename
141+
142+
# Set it as the current profile
143+
if ModLoaderStore.current_user_profile == ModLoaderStore.user_profiles[old_profile_name]:
144+
ModLoaderStore.current_user_profile[new_profile_name]
145+
>>>>>>> 5e66546 (Corrected false indentation and error)
126146

127147
# Store the new profile in the json file
128148
var is_save_success := _save()

0 commit comments

Comments
 (0)