Skip to content

Commit 4d5f50d

Browse files
Edit proper settings file. Add protection on create settings backup (#2938)
1 parent b3dcde1 commit 4d5f50d

File tree

5 files changed

+15
-8
lines changed

5 files changed

+15
-8
lines changed

README.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Likewise, the current version of wxPython, is 4.2.2, but RIDE is known to work w
4040

4141
`pip install -U robotframework-ride`
4242

43-
(3.8 <= python <= 3.13) Install current development version (**2.2dev21**) with:
43+
(3.8 <= python <= 3.13) Install current development version (**2.2dev22**) with:
4444

4545
`pip install -U https://github.com/robotframework/RIDE/archive/develop.zip`
4646

src/robotide/application/releasenotes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ def set_content(self, html_win, content):
234234
<pre class="literal-block">python -m robotide.postinstall -install</pre>
235235
<p>or</p>
236236
<pre class="literal-block">ride_postinstall.py -install</pre>
237-
<p>RIDE {VERSION} was released on 14/April/2025.</p>
237+
<p>RIDE {VERSION} was released on 15/April/2025.</p>
238238
<!-- <br/>
239239
<h3>May The Fourth Be With You!</h3>
240240
<h3>Celebrate the bank holiday, 10th June, Day of Portugal, Portuguese Communities and Camões!!</h3>

src/robotide/preferences/editor.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ def __init__(self, *args, **kwargs):
210210
hsizer = wx.BoxSizer(wx.HORIZONTAL)
211211
config_button = ButtonWithHandler(self, _('Settings'), bitmap='wrench_orange.png',
212212
fsize=self.settings[FONT_SIZE],
213-
handler=lambda e: self.on_edit_settings())
213+
handler=lambda e: self.on_edit_settings(self._settings.user_path))
214214
config_button.SetBackgroundColour(self.settings['background'])
215215
config_button.SetOwnBackgroundColour(self.settings['background'])
216216
config_button.SetForegroundColour(self.settings['foreground'])
@@ -270,11 +270,14 @@ def SetTitle(self, title):
270270
"""Set the title of the panel"""
271271
self.title.SetLabel(title)
272272

273-
def on_edit_settings(self):
273+
def on_edit_settings(self, path):
274274
"""Starts Text Editor for settings file and closes all if changed"""
275275
from ..editor import customsourceeditor
276276
from ..context import SETTINGS_DIRECTORY
277277
main_settings_path = os.path.join(SETTINGS_DIRECTORY, 'settings.cfg')
278-
customsourceeditor.main(main_settings_path)
278+
if path != main_settings_path:
279+
customsourceeditor.main(path)
280+
else:
281+
customsourceeditor.main(main_settings_path)
279282
# DEBUG close parent test
280-
# self.parent.Close()
283+
# self.parent.Close()

src/robotide/preferences/settings.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,11 @@ def _copy_or_migrate_user_settings(settings_dir, source_path, dest_file_name):
5050
if not os.path.exists(source_path):
5151
raise(FileNotFoundError(source_path))
5252
else:
53-
shutil.copyfile(source_path, source_path + '._backup')
53+
try:
54+
shutil.copyfile(source_path, source_path + '._backup')
55+
except (IOError, FileExistsError, PermissionError, OSError):
56+
backup_file = os.path.join(SETTINGS_DIRECTORY, os.path.basename(source_path))
57+
shutil.copyfile(source_path, backup_file + '._backup')
5458
if not dest_file_name:
5559
dest_file_name = os.path.basename(source_path)
5660
settings_path = os.path.join(settings_dir, dest_file_name)

src/robotide/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515
#
1616
# Automatically generated by `tasks.py`.
1717

18-
VERSION = 'v2.2dev21'
18+
VERSION = 'v2.2dev22'

0 commit comments

Comments
 (0)