Skip to content
This repository was archived by the owner on Jul 23, 2024. It is now read-only.

Commit fc9b75d

Browse files
author
u1f98e
committed
Fix renaming presets not changing the in file name
1 parent fada8a4 commit fc9b75d

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

gradience/utils/preset.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,16 +87,14 @@ def load_preset(self, preset_path=None, text=None, preset=None):
8787

8888
# Rename an existing preset
8989
def rename_preset(self, name):
90-
new_path = os.path.join(
90+
self.display_name = name
91+
old_path = self.preset_path
92+
self.preset_path = os.path.join(
9193
os.path.dirname(self.preset_path),
9294
to_slug_case(name) + ".json")
9395

94-
os.rename(
95-
self.preset_path,
96-
new_path
97-
)
98-
99-
self.preset_path = new_path
96+
self.save_preset(to=self.preset_path)
97+
os.remove(old_path)
10098

10199
# Save a new user preset (or overwrite one)
102100
def save_preset(self, name=None, plugins_list=None, to=None):

0 commit comments

Comments
 (0)